diff --git a/README.org b/README.org index 428c943..116ed54 100644 --- a/README.org +++ b/README.org @@ -228,6 +228,7 @@ of [[info:emacs#Saving Customizations][saving customizations (info)]]. recentf-max-saved-items 100 recentf-mode t save-place-mode t + savehist-mode t scroll-bar-mode nil tab-always-indent 'complete tool-bar-mode nil @@ -1353,10 +1354,11 @@ completion in any buffer. :END: Listing [[lst:enable-vertico-mode]] configures and enables =savehist-mode= and -enables =vertico-mode=. The documentation src_emacs-lisp{(describe-function -'savehist-mode)} why it is best to turn on =savehist-mode= in the Emacs init -file. BUG: Adding ~eww-history~, ~register-alist~, ~regexp-search-string~, or -~search-string~ to ~savehist-additional-variables~ fails to save the relevant +enables =vertico-mode=. The src_emacs-lisp{(describe-function 'savehist-mode)} +documentation explains why it is best to turn on =savehist-mode= in the +=user-init-file=. Listing [[lst:prune-file-name-history]] allows to prune +non-existing files from the file name history. BUG: Adding ~eww-history~ or +~register-alist~ to ~savehist-additional-variables~ fails to save the relevant histories. #+caption[Enable =savehist-mode= and =vertico-mode=]: @@ -1364,8 +1366,8 @@ histories. #+name: lst:enable-vertico-mode #+begin_src emacs-lisp -n :results silent (with-eval-after-load 'savehist - (setopt savehist-additional-variables '(kill-ring search-ring)) - (savehist-mode +1)) + (setopt savehist-additional-variables + '(command-history kill-ring regexp-search-ring search-ring))) (when (and (ensure-package-installation 'vertico) (fboundp 'vertico-directory-delete-char) (fboundp 'vertico-directory-delete-word) @@ -1379,6 +1381,22 @@ histories. (keymap-set vertico-map "RET" #'vertico-directory-enter))) #+end_src +#+caption[Prune non-existing files from =file-name-history=]: +#+caption: Prune non-existing files from =file-name-history=. +#+name: lst:prune-file-name-history +#+begin_src emacs-lisp -n :results silent +(defun prune-file-name-history () + "Prune non-existing files from `file-name-history'." + (interactive) + (let ((old (length file-name-history)) ok) + (dolist (name file-name-history) + (when (file-exists-p name) + (push name ok))) + (setq file-name-history (nreverse ok)) + (message "Pruned `file-name-history' from `%S' to `%S' files" + old (length file-name-history)))) +#+end_src + #+attr_latex: :booktabs yes :float table #+caption[Vertico key map bindings]: #+caption: Vertico key map bindings.