emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole b430d10 36/51: hpath:find: Was called with po


From: Stefan Monnier
Subject: [elpa] externals/hyperbole b430d10 36/51: hpath:find: Was called with point in the source, not referent buffer
Date: Sun, 12 Jul 2020 18:10:16 -0400 (EDT)

branch: externals/hyperbole
commit b430d108d1ae5002ca7b5d7c71db63aa94a115ca
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    hpath:find: Was called with point in the source, not referent buffer
---
 hpath.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/hpath.el b/hpath.el
index 4d62e6d..1f63811 100644
--- a/hpath.el
+++ b/hpath.el
@@ -920,8 +920,10 @@ buffer but don't display it."
     (setq path (hpath:substitute-value path)
          filename (hpath:absolute-to path default-directory))
     (if noselect
-       (prog1 (find-file-noselect filename)
-         (if (or hash anchor) (hpath:to-markup-anchor hash anchor)))
+       (let ((buf (find-file-noselect filename)))
+         (with-current-buffer buf
+           (when (or hash anchor) (hpath:to-markup-anchor hash anchor))
+           buf))
       (let ((remote-filename (hpath:remote-p path)))
        (or modifier remote-filename
            (file-exists-p filename)
@@ -989,7 +991,8 @@ buffer but don't display it."
                  (goto-char (point-min))
                  (if (re-search-forward (format hpath:html-anchor-id-pattern 
(regexp-quote anchor)) nil t)
                      (progn (forward-line 0)
-                            (recenter 0))
+                            (when (eq (current-buffer) (window-buffer))
+                              (recenter 0)))
                    (goto-char opoint)
                    (error "(hpath:to-markup-anchor): %s - Anchor `%s' not 
found in the visible buffer portion"
                           (buffer-name)
@@ -1016,7 +1019,8 @@ buffer but don't display it."
                                                (t 
hpath:outline-section-pattern))
                                          (regexp-quote anchor-name)) nil t)
                      (progn (forward-line 0)
-                            (recenter 0))
+                            (when (eq (current-buffer) (window-buffer))
+                              (recenter 0)))
                    (goto-char opoint)
                    (error "(hpath:to-markup-anchor): %s - Section `%s' not 
found in the visible buffer portion"
                           (buffer-name)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]