aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/saveplace.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index c27df150248..0233a5259a0 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -143,6 +143,7 @@ where it was when you previously visited the same file."
143 143
144(make-variable-buffer-local 'save-place-mode) ; Hysterical raisins. 144(make-variable-buffer-local 'save-place-mode) ; Hysterical raisins.
145 145
146;;;###autoload
146(defun toggle-save-place (&optional parg) ;FIXME: save-place-local-mode! 147(defun toggle-save-place (&optional parg) ;FIXME: save-place-local-mode!
147 "Toggle whether to save your place in this file between sessions. 148 "Toggle whether to save your place in this file between sessions.
148If this mode is enabled, point is recorded when you kill the buffer 149If this mode is enabled, point is recorded when you kill the buffer
@@ -165,6 +166,18 @@ file:
165 (setq save-place (if parg 166 (setq save-place (if parg
166 (> (prefix-numeric-value parg) 0) 167 (> (prefix-numeric-value parg) 0)
167 (not save-place))) 168 (not save-place)))
169 (cond
170 (save-place
171 (add-hook 'find-file-hook 'save-place-find-file-hook t)
172 (add-hook 'dired-initial-position-hook 'save-place-dired-hook)
173 (unless noninteractive
174 (add-hook 'kill-emacs-hook 'save-place-kill-emacs-hook))
175 (add-hook 'kill-buffer-hook 'save-place-to-alist))
176 (t
177 (remove-hook 'find-file-hook 'save-place-find-file-hook t)
178 (remove-hook 'dired-initial-position-hook 'save-place-dired-hook)
179 (remove-hook 'kill-emacs-hook 'save-place-kill-emacs-hook)
180 (remove-hook 'kill-buffer-hook 'save-place-to-alist)))
168 (message (if save-place 181 (message (if save-place
169 "Place will be saved" 182 "Place will be saved"
170 "No place will be saved in this file")))) 183 "No place will be saved in this file"))))