]> git.eshelyaron.com Git - emacs.git/commitdiff
New hook save-place-after-find-file-hook
authorStefan Kangas <stefan@marxist.se>
Thu, 30 Jun 2022 11:47:59 +0000 (13:47 +0200)
committerStefan Kangas <stefan@marxist.se>
Thu, 30 Jun 2022 12:07:15 +0000 (14:07 +0200)
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
lisp/saveplace.el

index ad0acd674e2423d1d7700c2165b2ad6d65e81efc..e757435ff91eef4da6dd57f5b5358a2022da4e8d 100644 (file)
--- 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.
index a23454b0bb4d94fac114cffab4be5a13302317eb..3830e4b16cfcc53d96234b9fec064b9b034cdba1 100644 (file)
@@ -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))