[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Saving minibuffer history
From: |
Stefan Monnier |
Subject: |
Re: Saving minibuffer history |
Date: |
Sun, 16 Oct 2005 11:39:19 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
>> I installed it. Thanks.
> Thank you. An improved version is now available at
> <http://fly.srk.fer.hr/~hniksic/emacs/savehist.el>.
Thank you. Installed. Along with a few minor changes, mostly to remove
run-time dependency on CL and to get rid of most checks for XEmacs, replaced
by checks for features.
I have one question: what's the point of savehist-no-conversion?
Also see attached a proposed patch (100% guaranteed untested). If nobody
objects, I'll install it.
I could also get rid of savehist-history-variables altogether.
Stefan
2005-10-16 Stefan Monnier <address@hidden>
* savehist.el (savehist-file): Use the ~/.emacs.d directory.
(savehist-all-history-variables): New var.
(savehist-minibuffer-hook): New fun to populate it.
(savehist-save): Use and save it.
(savehist-history-variables): Default to nil, meaning "all".
Index: savehist.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/savehist.el,v
retrieving revision 1.3
diff -u -u -b -r1.3 savehist.el
--- savehist.el 16 Oct 2005 15:22:37 -0000 1.3
+++ savehist.el 16 Oct 2005 15:33:46 -0000
@@ -52,64 +52,20 @@
"Save minibuffer history."
:group 'minibuffer)
-(defcustom savehist-history-variables
- '(
- ;; Catch-all minibuffer history
- minibuffer-history
- ;; File-oriented commands
- file-name-history
- ;; Regexp-related reads
- regexp-history
- ;; Searches in minibuffer (via `M-r' and such)
- minibuffer-history-search-history
- ;; Query replace
- query-replace-history
- ;; eval-expression (`M-:')
- read-expression-history
- ;; shell-command (`M-!')
- shell-command-history
- ;; compile
- compile-history
- ;; find-tag (`M-.')
- find-tag-history
- ;; grep
- grep-history
- ;; Viper stuff
- vip-ex-history vip-search-history
- vip-replace1-history vip-replace2-history
- vip-shell-history vip-search-history
-
- ;; XEmacs-specific:
- ;; Buffer-related commands
- buffer-history
- ;; Reads of variables and functions
- variable-history function-history
- ;; Extended commands
- read-command-history
-
- ;; Info, lookup, and bookmark historys
- Info-minibuffer-history
- Info-search-history
- Manual-page-minibuffer-history
-
- ;; Emacs-specific:
- ;; Extended commands
- extended-command-history)
+(defvar savehist-all-history-variables nil)
+
+(defcustom savehist-history-variables nil
"*List of symbols to be saved.
Every symbol should refer to a variable. The variable will be saved
only if it is bound and has a non-nil value. Thus it is safe to
specify a superset of the variables a user is expected to want to
save.
-Default value contains minibuffer history variables used by Emacs, XEmacs,
-and Viper (uh-oh). Note that, if you customize this variable, you
-can lose the benefit of future versions of Emacs adding new values to
-the list. Because of that it might be more useful to add values using
-`add-to-list'."
+If nil, all history variables will be saved."
:type '(repeat (symbol :tag "Variable"))
:group 'savehist)
-(defcustom savehist-file "~/.emacs-history"
+(defcustom savehist-file "~/.emacs.d/history"
"*File name to save minibuffer history to.
The minibuffer history is a series of Lisp expressions, which should be
loaded using `savehist-load' from your .emacs. See `savehist-load' for
@@ -201,7 +157,11 @@
(print-level nil)
(print-readably t)
(print-quoted t))
- (dolist (sym savehist-history-variables)
+ (prin1
+ `(setq savehist-all-history-variables ',savehist-all-history-variables)
+ (current-buffer))
+ (dolist (sym (or savehist-history-variables
+ savehist-all-history-variables))
(when (boundp sym)
(let ((value (savehist-process-for-saving (symbol-value sym))))
(prin1 `(setq ,sym ',value) (current-buffer))
@@ -261,6 +221,11 @@
t)
;; The attempt failed: the object is not printable.
(error nil)))))
+
+(defun savehist-minibuffer-hook ()
+ (add-to-list 'savehist-all-history-variables minibuffer-history-variable))
+
+(add-hook 'minibuffer-setup-hook 'savehist-minibuffer-hook)
(provide 'savehist)
- RE: Saving minibuffer history, (continued)
- Re: Saving minibuffer history, Hrvoje Niksic, 2005/10/16
- Re: Saving minibuffer history, Stefan Monnier, 2005/10/16
- Re: Saving minibuffer history, Hrvoje Niksic, 2005/10/18
- RE: Saving minibuffer history, Drew Adams, 2005/10/24
- RE: Saving minibuffer history, Drew Adams, 2005/10/24
- Re: Saving minibuffer history, Stefan Monnier, 2005/10/24
- Re: Saving minibuffer history,
Stefan Monnier <=
- Re: Saving minibuffer history, Hrvoje Niksic, 2005/10/18
- Re: Saving minibuffer history, Stefan Monnier, 2005/10/18
- Re: Saving minibuffer history, Hrvoje Niksic, 2005/10/18
- Re: Saving minibuffer history, Stefan Monnier, 2005/10/19
- Re: Saving minibuffer history, Hrvoje Niksic, 2005/10/20
- Re: Saving minibuffer history, Hrvoje Niksic, 2005/10/20
- Re: Saving minibuffer history, Stefan Monnier, 2005/10/20
- Re: Saving minibuffer history, Hrvoje Niksic, 2005/10/20
- Re: Saving minibuffer history, Hrvoje Niksic, 2005/10/24
- Re: Saving minibuffer history, Stefan Monnier, 2005/10/24