Rudy’s OBTF Rudolf Adamkovič

Home / Emacs / Save Hist / Commands


Delete history item

Useful for redacting sensitive information and typos.

(defun savehist-delete-history-item ()
  "Prompt for history variable and its element, then delete it."
  (interactive)
  (let* ((variables (append savehist-minibuffer-history-variables
                            savehist-additional-variables))
         (variable-name (completing-read "History variable: "
                                         variables
                                         nil
                                         t))
         (variable-symbol (intern variable-name))
         (variable (symbol-value variable-symbol))
         (element (completing-read "Element to delete: "
                                   variable
                                   nil
                                   t
                                   nil
                                   variable-symbol)))
    (set variable-symbol
         (delete element variable))))

© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.