有没有办法列出 dired 中的驱动器号?
在 Windows 上,我如何打开显示所有驱动器号的可怕缓冲区。当您执行 Cx d 时,您应该始终提供一个目录,但我想从驱动器号级别开始,而不是特定驱动器的根目录。
如果不存在标准解决方案,您有一个(dired 的扩展吗?)?或有关该主题的文章的链接?
On windows, how could I open a dired buffer showing all drive letters. When you do C-x d you should always provide a directory, but I want to start at the drive letters level instead of a root directory of a particular drive.
If no standard solution exists, do you have one (an extension to dired ?) ? or links to articles on the subject ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 dired 中,您只能查看目录,并且由于不存在包含您的驱动器号的目录,因此您看不到它们的列表。
为此,您必须为 dired 编写一个 emacs-lisp 扩展。
AFAIK 没有现有的扩展,但是,调用 wmic 可以为您提供驱动器号和卷名称的列表,这将是一个很好的起点。
wmic 命令:
从 emacs-lisp 调用它并以字符串形式获取结果。
将为您提供卷列表(驱动器类型:3 = HDD,4 = 网络映射,5 = 光纤。)
但是,您无法通过此输出来识别缓冲区,因此您需要创建一个主要的用于浏览 Windows 卷的模式,它将显示此列表并绑定 RET 以查找当前行上的驱动器号并在其根目录下执行 dired。
如果您只想列出驱动器号...
会这样做。
In dired you can only view directories, and since no directory exists which contains your drive letters, you can't see a list of them.
To do this you'd have to write an emacs-lisp extension for dired.
AFAIK there's no existing extension, however, a call to wmic can give you a listing of drive letters and volume names, which would be a good starting point.
The wmic command:
Calling it from emacs-lisp and getting the result as a string.
Will give you a list of the volumes (DriveType : 3 = HDD, 4 = Network Mapping, 5 = Optical.)
However, you can't get dired to recognize a buffer with this output, so you'd need to create a major mode for browsing windows volumes, which would show this listing and bind RET to find the drive letter on the current line and do a dired at it's root.
If you just want the drive letters listed...
Will do that.
Dired+ 有你想要的。
命令
diredp-w32-drives
打开 Windows 驱动器的列表/菜单。使用 RET 或 mouse-2 在其中一个驱动器上打开 Dired。本地驱动器来自选项diredp-w32-local-drives
,您可以自定义该选项。如果您在访问某个驱动器(例如
C:\
)时在 Dired 中点击 ^,那么您将进入所有驱动器的相同列表/菜单。Dired+ has what you want.
Command
diredp-w32-drives
opens a list/menu of the Windows drives. Use RET or mouse-2 to open Dired on one of the drives. The local drives come from optiondiredp-w32-local-drives
, which you can customize.If you hit ^ in Dired when visiting one of your drives (e.g.
C:\
), then you get to the same list/menu of all drives.