[英]changing the value of savehist-minibuffer-history-variables in Emacs
It says on lines 129-130 of https://github.com/emacs-mirror/emacs/blob/master/lisp/savehist.el that the default behaviour is to determine the contents of savehist-minibuffer-history-variables
while emacs is running.它在https://github.com/emacs-mirror/emacs/blob/master/lisp/savehist.el 的第 129-130 行说,默认行为是在 emacs 时确定savehist-minibuffer-history-variables
的内容在跑。 I indeed see in my savehist-file
that this appears to be yes-or-no-p-history
, buffer-name-history
and a few other variables.我确实在我的savehist-file
看到这似乎是yes-or-no-p-history
、 buffer-name-history
和一些其他变量。
However, I would like to save only a specific history in emacs, namely that of filesets-data
, implemented via但是,我只想在 emacs 中保存特定的历史记录,即filesets-data
历史记录,通过实现
(setq savehist-additional-variables '(filesets-data))
It says on lines 59-60 of savehist.el that this can be achieved by using savehist-save-hook
to change the value of savehist-minibuffer-history-variables
.它在savehist.el 的第 59-60 行说,这可以通过使用savehist-save-hook
更改savehist-minibuffer-history-variables
的值来savehist-minibuffer-history-variables
。
I unfortunately cannot figure out how to do that.不幸的是,我无法弄清楚如何做到这一点。 I have tried我试过了
(setq savehist-minibuffer-history-variables nil)
(add-hook 'savehist-save-hook 'savehist-minibuffer-history-variables)
in my .emacs.d
but that yields an error message:在我的.emacs.d
但会产生一条错误消息:
Symbol’s function definition is void: savehist-minibuffer-history-variables
Any help on changing savehist-minibuffer-history-variables
to be empty when exiting emacs is appreciated.感谢您在退出 emacs 时将savehist-minibuffer-history-variables
更改为空的任何帮助。 Thanks!谢谢!
The thing you put on a hook is a function , not a variable (and not some other sexp).你挂在钩子上的是一个函数,而不是一个变量(而不是其他一些性别)。
(defun foo ()
(setq savehist-minibuffer-history-variables nil))
(add-hook 'savehist-save-hook #'foo)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.