The simplest solution is to use the same method as employed by Recentf mode. It maintains the list of recently opened files, no matter what user-level command visited them, and doesn't include automatically processed files. It seems that users of Recentf mode are satisfied with its file list. So the same method could be used to add recently opened files to the file name history.
To update the list of recently opened files, Recentf mode puts the function `recentf-track-opened-file' in `find-file-hook'. The following code does the same to add recently opened files to the history: (add-hook 'find-file-hook 'add-file-name-to-history) (defun add-file-name-to-history () "Add the name of the file just opened to the history." (when (and buffer-file-name (or (null file-name-history) (not (equal buffer-file-name (car file-name-history))))) (if history-delete-duplicates (delete buffer-file-name file-name-history)) (setq file-name-history (cons buffer-file-name file-name-history)))) -- Juri Linkov http://www.jurta.org/emacs/ _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel