From f1e539139e2d71637550ceaba533daccfefd0498 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Mon, 4 Jan 2021 13:29:09 -0500 Subject: [PATCH] Add function to remove non-existant files from file-name-history --- .emacs.d/init.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 54cfcf7..1de62e7 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -61,7 +61,15 @@ (use-package savehist :demand :config - (savehist-mode)) + (savehist-mode) + (defun savehist-file-name-history-cleanup () + "Delete all the files in file-name-history that don't exist anymore" + (interactive) + (setq file-name-history + (seq-filter + (lambda (file) + (or (file-remote-p file) (file-exists-p file))) + file-name-history)))) (use-package paren :demand :config