[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master bf65073767: New hook save-place-after-find-file-hook
From: |
Stefan Kangas |
Subject: |
master bf65073767: New hook save-place-after-find-file-hook |
Date: |
Thu, 30 Jun 2022 08:08:17 -0400 (EDT) |
branch: master
commit bf65073767de47e3dfdb9b3086d4abd3ecb0089b
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>
New hook save-place-after-find-file-hook
This is intended for use in Org mode, where we currently use advise.
* lisp/saveplace.el (save-place-after-find-file-hook): New hook.
(save-place-find-file-hook): Run new hook.
---
etc/NEWS | 4 ++++
lisp/saveplace.el | 8 +++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/etc/NEWS b/etc/NEWS
index ad0acd674e..e757435ff9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2911,6 +2911,10 @@ when used as part of a property list specification for
the
** 'defalias' records a more precise history of definitions.
This is recorded in the 'function-history' symbol property.
+---
+** New hook 'save-place-after-find-file-hook'.
+This is called at the end of 'save-place-find-file-hook'.
+
---
** 'indian-tml-base-table' no longer translates digits.
Use 'indian-tml-base-digits-table' if you want digits translation.
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index a23454b0bb..3830e4b16c 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -346,7 +346,12 @@ may have changed) back to `save-place-alist'."
(save-place-to-alist))
(setq buf-list (cdr buf-list))))))
+(defvar save-place-after-find-file-hook nil
+ "Hook run at the end of `save-place-find-file-hook'.")
+
(defun save-place-find-file-hook ()
+ "Function added to `find-file-hook' by `save-place-mode'.
+It runs the hook `save-place-after-find-file-hook'."
(or save-place-loaded (load-save-place-alist-from-file))
(let ((cell (assoc buffer-file-name save-place-alist)))
(if cell
@@ -355,7 +360,8 @@ may have changed) back to `save-place-alist'."
(and (integerp (cdr cell))
(goto-char (cdr cell))))
;; and make sure it will be saved again for later
- (setq save-place-mode t)))))
+ (setq save-place-mode t))))
+ (run-hooks 'save-place-after-find-file-hook))
(declare-function dired-goto-file "dired" (file))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master bf65073767: New hook save-place-after-find-file-hook,
Stefan Kangas <=