I would like it if my Emacs were to save the M-x calls in most-recently used order and if this order could persist and grow across restarts/other sessions. I am using Helm, so I guess I should be asking about helm-M-x
, but I thought this would be a general problem which might have a solution.
Ideally the solution would not depend on desktop-save-mode
, but if it does I am okay with that.
Edit: Apparently I should be using savehist as I gathered from the comments, but for some reason it is not working. It seems like my savehist file is being populated, but it is not being loaded when I start Emacs anew.
(setq savehist-file "~/.emacs.d/savehist")
(setq history-length t)
(setq history-delete-duplicates t)
(setq savehist-additional-variables
'(savehist-minibuffer-history-variables
magit-read-rev-history
helm-M-x-input-history
read-expression-history
helm-grep-history
minibuffer-history
file-name-history
ido-file-history
evil-ex-history
mark-ring
search-ring
extended-command-history
evil-jumps-history
kill-ring
search-ring
regexp-search-ring
compile-history
log-edit-comment-ring
command-history))
(savehist-mode 1)
(savehist-mode 1)
in your init file. – phils Oct 1 '18 at 0:52helm-m-x
or are you asking aboutM-x
in general? The question isn't clear in this regard. – Drew Oct 1 '18 at 1:05savehist-additional-variables
. That is only needed for variables which are not already being treated as a minibuffer history. So adding ring variables is valid, but most of those-history
suffix vars are probably not needed. You can always do some testing withsavehist-mode
enabled (i.e. just invoke all the history-using features you are interested in) and then verify what ended up insavehist-minibuffer-history-variables
. – phils Oct 1 '18 at 3:06C-h v savehist-loaded
say after you start Emacs? (And if that indicates that it failed to load the file,savehist-mode
should have signaled an error.) – phils Oct 1 '18 at 3:09