alphapapa / org-bookmark-heading

Emacs bookmark support for Org-mode
GNU General Public License v3.0
93 stars 8 forks source link

Hook `org-bookmark-heading-after-jump-hook` is not always executed #30

Closed schwurg closed 4 months ago

schwurg commented 5 months ago

Dear Adam,

I just realized that the org-bookmark-heading-after-jump-hook is only executed in case the bookmark jumps to an indirect buffer. For normal jumps, the hook is not executed.

Looking at the code, I think the following patch should fix it:

diff --git a/org-bookmark-heading.el b/org-bookmark-heading.el
index 0c0b431..b04af0d 100644
--- a/org-bookmark-heading.el
+++ b/org-bookmark-heading.el
@@ -229,8 +229,8 @@ supported, in which case it should be an entry ID)."
             ;; non-indirect buffer at the bottom of the prev-buffers list
             ;; so it won't be selected when the indirect buffer is killed.
             (set-window-prev-buffers nil (append (cdr (window-prev-buffers))
-                                                 (list (car (window-prev-buffers))))))
-          (run-hooks 'org-bookmark-heading-after-jump-hook))
+                                                 (list (car (window-prev-buffers)))))))
+        (run-hooks 'org-bookmark-heading-after-jump-hook)
         (unless (equal (file-truename (or (buffer-file-name (buffer-base-buffer))
                                           (buffer-file-name)))
                        (file-truename filename))

(The patch is against git version ed8b7fe2a08b06a1d750d1e1230e6728815e0bcd)

Best regards, Tim.

(And thanks again for this package. I am using it each day!)

alphapapa commented 4 months ago

Hi Tim,

Thanks for the report. Of course, I forgot to put the "Fixes" metadata in the commit message, but this is now fixed in https://github.com/alphapapa/org-bookmark-heading/commit/719777cfe589b9941701f737905a200d9be4d130, which is released as v1.3.2 and now on master as well.

Thanks for the kind words. Glad that it's useful!

Adam