Add to GNOME’s recently used files listΒΆ describes how to add files opened in Emacs to GNOME’s recently used document list. Unfortunately the python script supplied an that page doesn’t work anymore with recent versions of GNOME.

As I didn’t find a better way I made my own version using PyGtk.

Download addtorecent and put it in your $PATH, and add this to your .emacs file:

(defun fd-add-file-to-recent ()
  (when buffer-file-name
    (start-process "addtorecent" nil "addtorecent"
                   (concat "file://" buffer-file-name)
                   "emacsclient %F")))

(add-hook 'find-file-hook 'fd-add-file-to-recent)

Make sure you have selected Emacs to open text/plain files in GNOME as GNOME doesn’t seem to use the given command.