[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Quickly Viewing Files in a File List, and then Quickly Closing
RE: Quickly Viewing Files in a File List, and then Quickly Closing
Fri, 18 Oct 2013 07:23:53 -0700 (PDT)
> I am looking for a "QuickLook" feature for Emacs. For example, when
> scrolling through a file list in dired (or sunrise commander):
> - is it possible to automatically show the contents of the file
> under point in a second window? But if point is moved, quickly
> move along and show the next file/image whatnot?
> - is there a "hold-down-button" to view, and let off button to
> resume browsing the file list?
> I currently use C-x 1 or C-x o q approaches, but I usually end up
> with e a bunch of buffers or sore fingers when going through many
> Does anyone have suggestions? I apologize if the answer is sitting
> in the Emacs manual.
Others have responded with various ways to accomplish what you want.
Here is yet another.
In Icicles, the commands that access files are multi-commands, which
means that you can use various keys to act on different completion
candidates. For example, you can cycle among the candidates that
match your current minibuffer input, using the `up' and `down' arrows.
If you hold down `Control' while doing that (i.e., `C-down') then
you act on each file in turn. (You can use `C-RET' to act on a file
that you have cycled to using just `up' or `down'.)
For `C-x C-f', for instance, the action is to visit the file, so if
you use `C-x C-f' and then hit `C-down' you will visit the next file.
Holding down Control and repeating `down' visits successive files, in
the current sort order. (You can change the sort order at any time
during completion, using `C-,'.)
The behavior is exactly as you described, with this exception: the
file buffers remain. That is, the default action for `C-x C-f' only
visits the file; it does not also kill the file's buffer later on.
You could easily define a command that would do that, say putting
the `kill-buffer' action on a timer or associating it with an event
(e.g. visiting the next file). On the other hand, it is also easy
to manually kill a lot of buffers at the same time.
(BTW, when you use `C-x C-f' you can match not only the file names
but also file contents, if you like. And `C-M-down', `C-RET' etc.
displays metadata about a file, instead of visiting it: permissions,
size, time of last this-and-that, etc.)
Icicles is available at EmacsWiki and MELPA:
Here is the doc string for `icicle-find-file':
Visit a file or dir whose name and/or content matches.
Candidate files and directories for completion are examined, and those
whose names and/or contents match your multi-completion input are
available to visit.
(Option `find-file-run-dired' determines whether you can actually
visit a directory candidate that you choose.)
If you use a prefix argument when you act on a completion candidate
(see below for the use of a prefix arg for the command itself.), then
you visit the file or dir in read-only mode. This includes when you
act on all candidates using `C-!': precede the `C-!' with a prefix
arg. This does not apply to the final candidate chosen (using `RET'
or `mouse-2') - a prefix arg has no effect for that.
Completion candidates are two-part multi-completions, with the second
part optional. If both parts are present they are separated by
`icicle-list-join-string' ("^G^J", by default).
The first part is matched as a regexp against a file or directory
name. The second part is matched as a regexp against the file or
directory content. Candidates that do not match are filtered out.
When matching file content, Icicles just looks for a single match.
Visiting the file does not move to that match or to any other match.
Matching is used only to filter candidate files.
However, if your input includes a content-matching part and it
matches, that part is automatically added to the Isearch regexp
history, `regexp-search-ring' whenever you hit `S-TAB' to complete.
This means that when you visit the file you can immediately search for
matches using `C-M-s' or `C-M-r'.
Your minibuffer input can match a name or content, or both. Use
`C-M-j' (equivalent here to `C-q C-g C-j') to input the default
To match `foo' against file and dir names, use input `foo'.
To match `bar' against file and dir contents, use input `C-M-j bar'.
To match both names and content, use input `foo C-M-j bar'.
Only the matching file and directory names are shown in buffer
`*Completions*', and only the chosen name is returned. The actual
content matches are unimportant anyway: content matching is used only
to filter the candidates.
If your input does not include a content-matching part then this
command acts similar to `icicle-find-file-no-search' (but with a
different use of the prefix argument).
If your input includes a content-matching part then all files and
directories matching the name part of your input (or all, if no name
part) are visited. This creates buffers visiting each matching
For a directory, a Dired buffer is used - that is the content that is
searched. (Actually, this is determined by option
As you would expect, content matching can be costly in time, even
though it can be quite helpful. Use name matching to narrow the set
of files that must be visited to search their contents.
When this command is finished, any unused buffers that were created
for content matching are killed, if option
`icicle-kill-visited-buffers-flag' is non-nil. But a prefix argument
flips the behavior specified by that option.
During completion (`*' means this requires library `Bookmark+'), you
can use the following keys:
C-c + - create a new directory
M-| - open Dired on the currently matching file names
S-delete - delete candidate file or (empty) dir
* C-x C-t * - narrow to files with all of the tags you specify
* C-x C-t + - narrow to files with some of the tags you specify
* C-x C-t % * - narrow to files with all tags matching a regexp
* C-x C-t % + - narrow to files with some tags matching a regexp
* C-x a + - add tags to current candidate
* C-x a - - remove tags from current candidate
* C-x m - access file bookmarks (not just autofiles)
Read input, then act on it.
Input-candidate completion and cycling are available. While cycling,
these keys with prefix `C-' are active:
`C-mouse-2', `C-return' - Act on current completion candidate only
`C-down', `C-wheel-down' - Move to next completion candidate and act
`C-up', `C-wheel-up' - Move to previous completion candidate and act
`C-next' - Move to next apropos-completion candidate and act
`C-prior' - Move to previous apropos-completion candidate and act
`C-end' - Move to next prefix-completion candidate and act
`C-home' - Move to previous prefix-completion candidate and act
`C-!' - Act on *all* candidates, successively (careful!)
When candidate action and cycling are combined (e.g. `C-next'), user
option `icicle-act-before-cycle-flag' determines which occurs first.
With prefix `C-M-' instead of `C-', the same keys (`C-M-mouse-2',
`C-M-RET', `C-M-down', and so on) provide help about candidates.
Use `mouse-2', `RET', or `S-RET' to finally choose a candidate, or
`C-g' to quit.
This is an Icicles command - see command `icicle-mode'.
- Quickly Viewing Files in a File List, and then Quickly Closing, Eric Brown, 2013/10/18
- Re: Quickly Viewing Files in a File List, and then Quickly Closing, Thorsten Jolitz, 2013/10/18
- Re: Quickly Viewing Files in a File List, and then Quickly Closing, Eric Abrahamsen, 2013/10/18
- Re: Quickly Viewing Files in a File List, and then Quickly Closing, Alan Schmitt, 2013/10/18
- RE: Quickly Viewing Files in a File List, and then Quickly Closing,
Drew Adams <=
- Re: Quickly Viewing Files in a File List, and then Quickly Closing, Vagn Johansen, 2013/10/19
- Re: Quickly Viewing Files in a File List, and then Quickly Closing, escherdragon, 2013/10/28