如果我标记了多个文件,除了在每个文件上运行dired-find-file
之外,如何在emacs中查找/访问所有这些标记文件?
是否有内置命令,还是需要一些额外的lisp代码?
答案 0 :(得分:31)
在Emacs 23.2及更高版本中,dired-x.el
模块可用,它使您可以访问完全符合要求的命令。加载后(通常只是(load "dired-x")
),您将能够调用函数dired-do-find-marked-files
。这是它的内置文档:
(dired-do-find-marked-files &optional NOSELECT)
Find all marked files displaying all of them simultaneously.
With optional NOSELECT just find files but do not select them.
The current window is split across all files marked, as evenly as possible.
Remaining lines go to bottom-most window. The number of files that can be
displayed this way is restricted by the height of the current window and
`window-min-height'.
To keep dired buffer displayed, type C-x 2 first.
To display just marked files, type C-x 1 first.
因此,在加载dired-x
之后,您可以使用 Mx dired-do-find-marked-files
RET ,您将获得您的问题所要求的内容:将访问所有标记的文件,就像您在所有这些文件上运行dired-find-file
一样。
答案 1 :(得分:23)
如果您将此添加到.emacs,您将能够通过键绑定'F'打开文件。
(eval-after-load "dired"
'(progn
(define-key dired-mode-map "F" 'my-dired-find-file)
(defun my-dired-find-file (&optional arg)
"Open each of the marked files, or the file under the point, or when prefix arg, the next N files "
(interactive "P")
(let* ((fn-list (dired-get-marked-files nil arg)))
(mapc 'find-file fn-list)))))
显然你可以根据需要覆盖内置的'f'。
答案 2 :(得分:6)
您可以尝试dired+,它为dired提供了许多扩展,包括选择多个文件并查找/查看所有文件的功能。