Skip to main content
1 of 4
Drew
  • 79.1k
  • 10
  • 123
  • 257

Do this:

(defvar my-hist nil)
(make-variable-buffer-local 'my-hist)

(defun my-function (hist)
  (read-from-minibuffer "> " nil nil nil hist))

(defun my-command ()
  (interactive)
  (add-to-history 'my-hist (my-function 'my-hist)))

Don't quote hist when you pass it to read-from-minibuffer. You want to pass its value, e.g. the symbol my-hist, and not the result of evaluating 'hist, which is the symbol hist.

Drew
  • 79.1k
  • 10
  • 123
  • 257