Is there a way to exclude .git/COMMIT_EDITMSG
files from file-name-history
? Now that I'm authoring commits with Magit, those commit message files are often the most recent entries in file-name-history
, which is annoying since they're never what I'm looking for when scrolling through history entries.
1 Answer
These files (COMMIT_EDITMSG
, git-rebase-todo
and others) are added to file-name-history
by server-visit-files
. It is possible to undo that by advising that function, and I have implemented that.
But I am unsure whether that advise should also remove entries for these files that already existed prior to that function being called. I think so because those entries are very likely there from before this advice was added. On the other hand this might surprise users who, for whatever reason, edit these files by manually opening them. I'll decide at a later time.
file-name-history
and notrecentf-list
? If it is the latter, then you can userecentf-exclude
. On the other handgit-commit.el
already includes(eval-after-load 'recentf '(add-to-list 'recentf-exclude git-commit-filename-regexp))
, so you shouldn't have to.find-file
and such should be added tofile-name-history
(I think). Do you do that? Why?find-file
on aCOMMIT_EDITMSG
file, but when I usefind-file
and hitM-p
(previous-history-element), there's usually aCOMMIT_EDITMSG
in there. To confirm, I first deleted it from file-name-history, inspecting the variable to ensure it was gone. Then I used Magit to author a commit, and inspecting file-name-history again showed it back in there.file-name-history
are wrong.server-visit-files
adds the file tofile-name-history
. I don't see any way to prevent that short of advising that function.