diff options
author | Stefan Kangas <stefan@marxist.se> | 2022-06-30 13:47:59 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2022-06-30 14:07:15 +0200 |
commit | bf65073767de47e3dfdb9b3086d4abd3ecb0089b (patch) | |
tree | 575967d2b903140959c27f3302afdcd8467208be /lisp/saveplace.el | |
parent | 80cf13a3d27d8a967feafeec32fd130529635592 (diff) | |
download | emacs-bf65073767de47e3dfdb9b3086d4abd3ecb0089b.tar.gz |
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.
Diffstat (limited to 'lisp/saveplace.el')
-rw-r--r-- | lisp/saveplace.el | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/saveplace.el b/lisp/saveplace.el index a23454b0bb4..3830e4b16cf 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)) |