aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman1994-04-04 01:05:07 +0000
committerRichard M. Stallman1994-04-04 01:05:07 +0000
commite7dc77f65ff30514107720982c1d593116e70458 (patch)
tree9893763e7dffdde5168abb78f7ee2032366a4e3b /lisp
parent853cf34623affd852129ad834015a91a16982ded (diff)
downloademacs-e7dc77f65ff30514107720982c1d593116e70458.tar.gz
emacs-e7dc77f65ff30514107720982c1d593116e70458.zip
(save-place-version-control): New var, for determining
how to back up the master saved-places file. (save-place-alist-to-file): Bind version-control depending on `save-place-version-control'. (hook for find-file-hooks): Specify the APPEND arg to add-hook.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/saveplace.el31
1 files changed, 24 insertions, 7 deletions
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index deaa13ed4f3..387f4be4d14 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -1,11 +1,11 @@
1;;; saveplace.el --- automatically save place in files. 1;;; saveplace.el --- automatically save place in files.
2 2
3;; Copyright (C) 1993 Free Software Foundation, Inc. 3;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
4 4
5;; Author: Karl Fogel <kfogel@cs.oberlin.edu> 5;; Author: Karl Fogel <kfogel@cs.oberlin.edu>
6;; Maintainer: FSF 6;; Maintainer: FSF
7;; Created: July, 1993 7;; Created: July, 1993
8;; Version: 1.0 8;; Version: 1.1
9;; Keywords: bookmarks, placeholders 9;; Keywords: bookmarks, placeholders
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
@@ -30,6 +30,9 @@
30;; value of buffer-local variable save-place to determine whether to 30;; value of buffer-local variable save-place to determine whether to
31;; save position or not. 31;; save position or not.
32;; 32;;
33;; Thanks to Stefan Schoef, who sent a patch with the
34;; `save-place-version-control' stuff in it.
35;;
33;; Don't autoload this, rather, load it, since it modifies 36;; Don't autoload this, rather, load it, since it modifies
34;; find-file-hooks and other hooks. 37;; find-file-hooks and other hooks.
35 38
@@ -59,6 +62,13 @@ simply put this in your `~/.emacs' file:
59(defvar save-place-file "~/.emacs-places" 62(defvar save-place-file "~/.emacs-places"
60 "*Name of the file that records `save-place-alist' value.") 63 "*Name of the file that records `save-place-alist' value.")
61 64
65(defvar save-place-version-control 'nospecial
66 "*Controls whether to make numbered backups of master save-place file.
67It can have four values: t, nil, `never', and `nospecial'. The first
68three have the same meaning that they do for the variable
69`version-control', and the final value `nospecial' means just use the
70value of `version-control'.")
71
62(defvar save-place-loaded nil 72(defvar save-place-loaded nil
63 "Non-nil means that the `save-place-file' has been loaded.") 73 "Non-nil means that the `save-place-file' has been loaded.")
64 74
@@ -114,9 +124,16 @@ To save places automatically in all files, put this in your `.emacs' file:
114 (delete-region (point-min) (point-max)) 124 (delete-region (point-min) (point-max))
115 (goto-char (point-min)) 125 (goto-char (point-min))
116 (print save-place-alist (current-buffer)) 126 (print save-place-alist (current-buffer))
117 (write-file file) 127 (let ((version-control
118 (kill-buffer (current-buffer)) 128 (cond
119 (message (format "Saving places to %s... done." file))))) 129 ((null save-place-version-control) nil)
130 ((eq 'never save-place-version-control) 'never)
131 ((eq 'nospecial save-place-version-control) version-control)
132 (t
133 t))))
134 (write-file file)
135 (kill-buffer (current-buffer))
136 (message (format "Saving places to %s... done." file))))))
120 137
121(defun load-save-place-alist-from-file () 138(defun load-save-place-alist-from-file ()
122 (if (not save-place-loaded) 139 (if (not save-place-loaded)
@@ -169,7 +186,8 @@ To save places automatically in all files, put this in your `.emacs' file:
169 (progn 186 (progn
170 (goto-char (cdr cell)) 187 (goto-char (cdr cell))
171 ;; and make sure it will be saved again for later. 188 ;; and make sure it will be saved again for later.
172 (setq save-place t))))))) 189 (setq save-place t))))))
190 t)
173 191
174(add-hook 'kill-emacs-hook 192(add-hook 'kill-emacs-hook
175 (function 193 (function
@@ -183,4 +201,3 @@ To save places automatically in all files, put this in your `.emacs' file:
183(provide 'saveplace) ; why not... 201(provide 'saveplace) ; why not...
184 202
185;;; saveplace.el ends here 203;;; saveplace.el ends here
186