[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 040e0d6: Fix 'toggle-save-place'
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-25 040e0d6: Fix 'toggle-save-place' |
Date: |
Wed, 24 Feb 2016 20:57:10 +0000 |
branch: emacs-25
commit 040e0d6b3b9e7222707ba96a57f3abeef1f5fe88
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Fix 'toggle-save-place'
* lisp/saveplace.el (toggle-save-place): Set up hooks necessary to
support save-place in the buffer. Autoload the command.
---
lisp/saveplace.el | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index c27df15..0233a52 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -143,6 +143,7 @@ where it was when you previously visited the same file."
(make-variable-buffer-local 'save-place-mode) ; Hysterical raisins.
+;;;###autoload
(defun toggle-save-place (&optional parg) ;FIXME: save-place-local-mode!
"Toggle whether to save your place in this file between sessions.
If this mode is enabled, point is recorded when you kill the buffer
@@ -165,6 +166,18 @@ file:
(setq save-place (if parg
(> (prefix-numeric-value parg) 0)
(not save-place)))
+ (cond
+ (save-place
+ (add-hook 'find-file-hook 'save-place-find-file-hook t)
+ (add-hook 'dired-initial-position-hook 'save-place-dired-hook)
+ (unless noninteractive
+ (add-hook 'kill-emacs-hook 'save-place-kill-emacs-hook))
+ (add-hook 'kill-buffer-hook 'save-place-to-alist))
+ (t
+ (remove-hook 'find-file-hook 'save-place-find-file-hook t)
+ (remove-hook 'dired-initial-position-hook 'save-place-dired-hook)
+ (remove-hook 'kill-emacs-hook 'save-place-kill-emacs-hook)
+ (remove-hook 'kill-buffer-hook 'save-place-to-alist)))
(message (if save-place
"Place will be saved"
"No place will be saved in this file"))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-25 040e0d6: Fix 'toggle-save-place',
Eli Zaretskii <=