Commit e7dc77f6 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(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
(hook for find-file-hooks): Specify the APPEND arg to add-hook.
parent 853cf346
;;; saveplace.el --- automatically save place in files.
;; Copyright (C) 1993 Free Software Foundation, Inc.
;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
;; Author: Karl Fogel <>
;; Maintainer: FSF
;; Created: July, 1993
;; Version: 1.0
;; Version: 1.1
;; Keywords: bookmarks, placeholders
;; This file is part of GNU Emacs.
......@@ -30,6 +30,9 @@
;; value of buffer-local variable save-place to determine whether to
;; save position or not.
;; Thanks to Stefan Schoef, who sent a patch with the
;; `save-place-version-control' stuff in it.
;; Don't autoload this, rather, load it, since it modifies
;; find-file-hooks and other hooks.
......@@ -59,6 +62,13 @@ simply put this in your `~/.emacs' file:
(defvar save-place-file "~/.emacs-places"
"*Name of the file that records `save-place-alist' value.")
(defvar save-place-version-control 'nospecial
"*Controls whether to make numbered backups of master save-place file.
It can have four values: t, nil, `never', and `nospecial'. The first
three have the same meaning that they do for the variable
`version-control', and the final value `nospecial' means just use the
value of `version-control'.")
(defvar save-place-loaded nil
"Non-nil means that the `save-place-file' has been loaded.")
......@@ -114,9 +124,16 @@ To save places automatically in all files, put this in your `.emacs' file:
(delete-region (point-min) (point-max))
(goto-char (point-min))
(print save-place-alist (current-buffer))
(write-file file)
(kill-buffer (current-buffer))
(message (format "Saving places to %s... done." file)))))
(let ((version-control
((null save-place-version-control) nil)
((eq 'never save-place-version-control) 'never)
((eq 'nospecial save-place-version-control) version-control)
(write-file file)
(kill-buffer (current-buffer))
(message (format "Saving places to %s... done." file))))))
(defun load-save-place-alist-from-file ()
(if (not save-place-loaded)
......@@ -169,7 +186,8 @@ To save places automatically in all files, put this in your `.emacs' file:
(goto-char (cdr cell))
;; and make sure it will be saved again for later.
(setq save-place t)))))))
(setq save-place t))))))
(add-hook 'kill-emacs-hook
......@@ -183,4 +201,3 @@ To save places automatically in all files, put this in your `.emacs' file:
(provide 'saveplace) ; why not...
;;; saveplace.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment