I'd like to make the size of the emacs command history unlimited. I open and edit too many files in many different folders and I need a way to keep track of them. The emacs command history looks like a good place to do that. How can I do that?
2 Answers
I don't know if there's a command history proper, but there's a minibuffer history. The manual says the following about it:
Every argument that you enter with the minibuffer is saved in a “minibuffer history list” so you can easily use it again later.
then
Emacs keeps separate history lists for several different kinds of arguments. For example, there is a list for file names, used by all the commands that read file names. Other history lists include buffer names, command names (used by ‘M-x’), and command arguments (used by commands like ‘query-replace’).
The file of file names is what you want. About the length of these lists:
The variable ‘history-length’ specifies the maximum length of a minibuffer history list; adding a new element deletes the oldest element if the list gets too long. If the value is ‘t’, there is no maximum length.
So you can achieve that by adding the following line in you init file:
(setq history-length t)
Your original post sounds like an XY problem: you want to keep track of lots of buffers and files (the real issue), and you wonder if the command history would be a good way to do that.
Depending on your needs (hard to tell from the original post), try using:
ibuffer
to manage your buffers and files.projectile
to manage your projects.ibuffer-projectile
to integrateibuffer
andprojectile
.
-
Thank you for the answer. The need should be evident: Keeping history of all files I've opened in Emacs. Emacs seems to have a limit on that, which is 10 items or so, which was way too low for me. (setq history-length t) solved the issue. Thanks.– TerryCommented Jul 14, 2017 at 11:51