annotate lisp/savehist.el @ 83395:b31326248cf6

Merged from miles@gnu.org--gnu-2005 (patch 142-148, 615-628) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-615 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-616 Add lisp/mh-e/.arch-inventory * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-617 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-618 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-619 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-620 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-622 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-623 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-624 Update from CVS: lisp/smerge-mode.el: Add 'tools' to file keywords. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-625 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-626 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-627 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-628 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-142 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-143 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-144 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-145 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-146 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-147 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-148 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-435
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 01 Nov 2005 06:23:08 +0000
parents 9ee3fe90596c
children 00e4363eadb1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
1 ;;; savehist.el --- Save minibuffer history.
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
3 ;; Copyright (C) 1997,2005 Free Software Foundation
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: Hrvoje Niksic <hniksic@xemacs.org>
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Keywords: minibuffer
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
7 ;; Version: 9
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; any later version.
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; Boston, MA 02110-1301, USA.
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
28 ;; Many editors (e.g. Vim) have the feature of saving minibuffer
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
29 ;; history to an external file after exit. This package provides the
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
30 ;; same feature in Emacs. When set up, it saves recorded minibuffer
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
31 ;; histories to a file (`~/.emacs-history' by default). Additional
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
32 ;; variables may be specified by customizing
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
33 ;; `savehist-additional-variables'.
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; To use savehist, put the following to `~/.emacs':
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;;
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; (require 'savehist)
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; (savehist-load)
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
40 ;; If you are using a version of Emacs that does not ship with this
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
41 ;; package, be sure to have `savehist.el' in a directory that is in
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
42 ;; your load-path, and to byte-compile it.
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
43
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;;; Code:
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
46 (require 'custom)
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
47 (eval-when-compile
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
48 (require 'cl))
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
49
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;; User variables
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 (defgroup savehist nil
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 "Save minibuffer history."
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 :group 'minibuffer)
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
56 (defcustom savehist-save-minibuffer-history t
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
57 "If non-nil, save all recorded minibuffer histories."
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
58 :type 'boolean
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
59 :group 'savehist)
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
61 (defcustom savehist-additional-variables ()
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
62 "List of additional variables to save.
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
63 Each element is a symbol whose value will be persisted across Emacs
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
64 sessions that use savehist. The contents of variables should be
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
65 printable with the Lisp printer. If the variable's value is a list,
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
66 it will be trimmed to `savehist-length' elements.
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
68 You don't need to add minibuffer history variables to this list. All
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
69 minibuffer histories will be saved automatically."
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 :type '(repeat (symbol :tag "Variable"))
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 :group 'savehist)
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 (defcustom savehist-file "~/.emacs-history"
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
74 "File name to save minibuffer history to.
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 The minibuffer history is a series of Lisp expressions, which should be
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 loaded using `savehist-load' from your .emacs. See `savehist-load' for
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 more details."
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 :type 'file
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 :group 'savehist)
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 (defcustom savehist-length 100
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
82 "Maximum length of a minibuffer list.
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
83 Minibuffer histories with more entries are trimmed when saved, the older
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
84 entries being removed first. If set to nil, the length is unlimited."
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 :type '(choice integer
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (const :tag "Unlimited" nil))
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 :group 'savehist)
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
89 (defcustom savehist-modes #o600
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
90 "Default permissions of the history file.
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
91 This is decimal, not octal. The default is 384 (0600 in octal).
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
92 Set to nil to use the default permissions that Emacs uses, typically
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
93 mandated by umask. The default is a bit more restrictive to protect
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
94 the user's privacy."
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
95 :type 'integer
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
96 :group 'savehist)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
97
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
98 (defcustom savehist-autosave-interval (* 5 60)
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
99 "The interval during which savehist should autosave the history buffer."
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 :type 'integer
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 :group 'savehist)
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102
66205
e52f114d1dc3 (savehist-coding-system): Revert to checking XEmacs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66191
diff changeset
103 (defvar savehist-coding-system
e52f114d1dc3 (savehist-coding-system): Revert to checking XEmacs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66191
diff changeset
104 ;; UTF-8 is usually preferable to ISO-2022-8 when available, but under
e52f114d1dc3 (savehist-coding-system): Revert to checking XEmacs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66191
diff changeset
105 ;; XEmacs, UTF-8 is provided by external packages, and may not always be
e52f114d1dc3 (savehist-coding-system): Revert to checking XEmacs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66191
diff changeset
106 ;; available, so even if it currently is available, we prefer not to
e52f114d1dc3 (savehist-coding-system): Revert to checking XEmacs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66191
diff changeset
107 ;; use is.
e52f114d1dc3 (savehist-coding-system): Revert to checking XEmacs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66191
diff changeset
108 (if (featurep 'xemacs) 'iso-2022-8 'utf-8)
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
109 "The coding system savehist uses for saving the minibuffer history.
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
110 Changing this value while Emacs is running is supported, but considered
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
111 unwise, unless you know what you are doing.")
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
112
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
113 ;; Internal variables.
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
114
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
115 (defvar savehist-timer nil)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
116
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
117 (defvar savehist-last-checksum nil)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
118
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
119 (defvar savehist-minibuffer-history-variables nil)
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
120
66121
b1015e4158db Don't require CL at runtime.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66120
diff changeset
121 (defconst savehist-no-conversion (if (featurep 'xemacs) 'binary 'no-conversion)
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
122 "Coding system without conversion, only used for calculating checksums.
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
123 It should be as discriminating as `savehist-coding-system' but faster.")
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
125 ;; Functions.
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
126
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
127 (defun savehist-install ()
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
128 "Hook savehist into Emacs.
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
129 This will install `savehist-autosave' in `kill-emacs-hook' and on a timer.
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
130 To undo this, call `savehist-uninstall'."
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
131 (add-hook 'minibuffer-setup-hook 'savehist-minibuffer-hook)
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
132 (add-hook 'kill-emacs-hook 'savehist-autosave)
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
133 ;; Install an invocation of savehist-autosave on a timer. This
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
134 ;; should not cause noticeable delays for users -- savehist-autosave
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
135 ;; executes in under 5 ms on my system.
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
136 (unless savehist-timer
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
137 (setq savehist-timer
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
138 (if (featurep 'xemacs)
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
139 (start-itimer
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
140 "savehist" 'savehist-autosave savehist-autosave-interval
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
141 savehist-autosave-interval)
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
142 (run-with-timer savehist-autosave-interval savehist-autosave-interval
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
143 'savehist-autosave)))))
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
144
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
145 (defun savehist-uninstall ()
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
146 "Undo installing savehist."
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
147 (remove-hook 'minibuffer-setup-hook 'savehist-minibuffer-hook)
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
148 (remove-hook 'kill-emacs-hook 'savehist-autosave)
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
149 (when savehist-timer
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
150 (if (featurep 'xemacs)
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
151 (delete-itimer savehist-timer)
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
152 (cancel-timer savehist-timer))
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
153 (setq savehist-timer nil)))
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 ;;;###autoload
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
156 (defun savehist-load (&optional no-install)
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 "Load the minibuffer histories from `savehist-file'.
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
158 Unless NO-INSTALL is present and non-nil, the function will also install
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
159 `savehist-autosave' in `kill-emacs-hook' and on a timer, ensuring that
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
160 history is saved before leaving Emacs.
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
162 This function should be normally used from your Emacs init file. Since
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
163 it removes your current minibuffer histories, it is unwise to call it at
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
164 any other time."
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 (interactive "P")
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
166 ;; Don't set coding-system-for-read here. We rely on autodetection
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
167 ;; and the coding cookie to convey that information. That way, if
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
168 ;; the user changes the value of savehist-coding-system, we can
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
169 ;; still correctly load the old file.
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
170 (load savehist-file t (not (interactive-p)))
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
171 (unless no-install
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
172 (savehist-install)))
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 ;;;###autoload
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
175 (defun savehist-save (&optional auto-save)
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
176 "Save the values of minibuffer history variables.
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
177 Unbound symbols referenced in `savehist-additional-variables' are ignored.
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
178 If AUTO-SAVE is non-nil, compare the saved contents to the one last saved,
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
179 and don't save the buffer if they are the same."
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 (interactive)
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
181 (with-temp-buffer
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
182 (insert
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
183 (format ";; -*- mode: emacs-lisp; coding: %s -*-\n" savehist-coding-system)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
184 ";; Minibuffer history file, automatically generated by `savehist'.\n\n")
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
185 (let ((print-length nil)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
186 (print-string-length nil)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
187 (print-level nil)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
188 (print-readably t)
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
189 (print-quoted t)
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
190 (symbol-list (append
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
191 (and savehist-save-minibuffer-history
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
192 (cons 'savehist-minibuffer-history-variables
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
193 savehist-minibuffer-history-variables))
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
194 savehist-additional-variables)))
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
195 (dolist (sym symbol-list)
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
196 (when (boundp sym)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
197 (let ((value (savehist-process-for-saving (symbol-value sym))))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
198 (prin1 `(setq ,sym ',value) (current-buffer))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
199 (insert ?\n)))))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
200 ;; If autosaving, avoid writing if nothing has changed since the
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
201 ;; last write.
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
202 (let ((checksum (md5 (current-buffer) nil nil savehist-no-conversion)))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
203 (unless (and auto-save (equal checksum savehist-last-checksum))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
204 ;; Set file-precious-flag when saving the buffer because we
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
205 ;; don't want a half-finished write ruining the entire
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
206 ;; history. Remember that this is run from a timer and from
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
207 ;; kill-emacs-hook, and also that multiple Emacs instances
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
208 ;; could write to this file at once.
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
209 (let ((file-precious-flag t)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
210 (coding-system-for-write savehist-coding-system))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
211 (write-region (point-min) (point-max) savehist-file nil
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
212 (unless (interactive-p) 'quiet)))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
213 (when savehist-modes
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
214 (set-file-modes savehist-file savehist-modes))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
215 (setq savehist-last-checksum checksum)))))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
216
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
217 (defun savehist-autosave ()
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
218 "Save the minibuffer history if it has been modified since the last save."
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
219 (savehist-save t))
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
221 (defun savehist-process-for-saving (value)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
222 ;; Process VALUE for saving to file. If it is a list, retain only
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
223 ;; the first `savehist-length' values and prune non-printable ones.
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
224 ;; If VALUE is not a list, return it as-is if it is printable and
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
225 ;; nil otherwise.
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
226 (cond
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
227 ((listp value)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
228 (when (and savehist-length (> (length value) savehist-length))
66191
3b427dc36c6e (savehist-load): Revert to checking XEmacs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66129
diff changeset
229 ;; This should be: (setq value (subseq value 0 savehist-length))
66121
b1015e4158db Don't require CL at runtime.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66120
diff changeset
230 (setq value (copy-sequence value))
b1015e4158db Don't require CL at runtime.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66120
diff changeset
231 (setcdr (nthcdr savehist-length value) nil))
66191
3b427dc36c6e (savehist-load): Revert to checking XEmacs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66129
diff changeset
232 ;; And this should be (remove-if-not #'savehist-printable value)
66121
b1015e4158db Don't require CL at runtime.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66120
diff changeset
233 (delq nil (mapcar (lambda (x) (if (savehist-printable x) x)) value)))
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
234 ((savehist-printable value) value)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
235 (t nil)))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
236
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
237 (defun savehist-printable (value)
66121
b1015e4158db Don't require CL at runtime.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66120
diff changeset
238 "Return non-nil if VALUE is printable."
66120
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
239 ;; Quick response for oft-encountered types known to be printable.
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
240 (cond
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
241 ((stringp value))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
242 ((numberp value))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
243 ((symbolp value))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
244 (t
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
245 ;; For others, check explicitly.
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
246 (condition-case nil
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
247 (let ((print-readably t)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
248 (print-level nil)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
249 (chars ()))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
250 ;; Print the value into a string...
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
251 (prin1 value (lambda (char) (push char chars)))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
252 ;; ...and attempt to read it.
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
253 (read (apply #'string (nreverse chars)))
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
254 ;; The attempt worked: the object is printable.
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
255 t)
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
256 ;; The attempt failed: the object is not printable.
87310076f109 (savehist-autosave-interval, savehist-coding-system, savehist-timer)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66106
diff changeset
257 (error nil)))))
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258
66406
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
259 (defun savehist-minibuffer-hook ()
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
260 (add-to-list 'savehist-minibuffer-history-variables
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
261 minibuffer-history-variable))
9ee3fe90596c Require CL while compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66316
diff changeset
262
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 (provide 'savehist)
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264
66129
b6299ce0d13f Add arch tagline
Miles Bader <miles@gnu.org>
parents: 66121
diff changeset
265 ;; arch-tag: b3ce47f4-c5ad-4ebc-ad02-73aba705cf9f
66106
9b8e76617c8c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 ;;; savehist.el ends here