4

I am looking for a solution for recently visited files and/or directories by applications run in gnome terminal here

When I saw that question I thought of Emacs. Emacs has recentf-mode, does that mean that if I open a shell buffer by M-xshell or M-xterm, all the files I visited by calling specific programs (e.g. evince for pdf, emacs for text files) from the shell buffer, will be recorded by the recentf-mode and accessed by recentf-open-files?

What kind of "visit" is qualified to be recorded?

  • In the specific case of pdf files, you can view them directly within emacs (just by visiting them normally using C-x C-f). This way, they will be recorded in recentf (but obviously you will be viewing in Emacs, which doesn't provide the same features as evince). – ffevotte Nov 22 '14 at 15:36
3

The manual describes what visiting means:

Visiting a file means reading a file into a buffer. Once this is done, we say that the buffer is visiting that file, and call the file “the visited file” of the buffer.

http://www.gnu.org/software/emacs/manual/html_node/elisp/Visiting-Files.html

It is possible to add files used in the shell buffers to recent files, but it has to be implemented. One should write a hook which is executed after every shell command, parses the command line and adds the file to recent files. One obvious problem is that you have to add knowledge of different commands, because they can have file arguments in different positions on the command line, there can be mutiple file arguments for the command, etc.

  • Are files loadable into buffers only plain text files? – Tim Nov 22 '14 at 11:04
  • No, you can read any files into buffers, though binary files will show only garbage if read as text, though their names will be added to recent files. – Tom Nov 22 '14 at 11:05
  • but recording binary files visited is generally meaningless, since we can't do meaningful things with their content generally? – Tim Nov 22 '14 at 11:06
  • Usually yes, if you think of executable files, though with M-x hexl-mode you can edit binary files in emacs. – Tom Nov 22 '14 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.