]> git.eshelyaron.com Git - emacs.git/commitdiff
Widen buffer before going to point found by xref-find-definitions (bug#44294)
authorJuri Linkov <juri@linkov.net>
Thu, 29 Oct 2020 09:09:20 +0000 (11:09 +0200)
committerJuri Linkov <juri@linkov.net>
Thu, 29 Oct 2020 09:09:20 +0000 (11:09 +0200)
* lisp/progmodes/elisp-mode.el (xref-location-marker): Widen before going
to the found position.

* lisp/progmodes/etags.el (etags-goto-tag-location): Rerun after removing
narrowing.

* lisp/simple.el (goto-line-read-args): Use buffer-narrowed-p.

lisp/progmodes/elisp-mode.el
lisp/progmodes/etags.el
lisp/simple.el

index eed73f579181ac9fe80d555b6d9718b7e723a3ce..c7ff351845e2fb884479a267e05876a2dfe05bd4 100644 (file)
@@ -897,8 +897,10 @@ non-nil result supersedes the xrefs produced by
     (let ((buffer-point (find-function-search-for-symbol symbol type file)))
       (with-current-buffer (car buffer-point)
         (save-excursion
-          (goto-char (or (cdr buffer-point) (point-min)))
-          (point-marker))))))
+          (save-restriction
+            (widen)
+            (goto-char (or (cdr buffer-point) (point-min)))
+            (point-marker)))))))
 
 (cl-defmethod xref-location-group ((l xref-elisp-location))
   (xref-elisp-location-file l))
index f6af1f2ea84fca9fc8c53c8ee9d2449abc81a529..41ed31776602d4de9ef0dbf8cebe3b584a014132 100644 (file)
@@ -1406,8 +1406,13 @@ hits the start of file."
              offset (* 3 offset)))     ; expand search window
       (or found
          (re-search-forward pat nil t)
-         (user-error "Rerun etags: `%s' not found in %s"
-                      pat buffer-file-name)))
+         (if (and (buffer-narrowed-p) widen-automatically)
+              (progn
+                ;; Rerun after removing narrowing
+                (widen)
+                (etags-goto-tag-location tag-info))
+            (user-error "Rerun etags: `%s' not found in %s"
+                        pat buffer-file-name))))
     ;; Position point at the right place
     ;; if the search string matched an extra Ctrl-m at the beginning.
     (and (eq selective-display t)
index a29f85b3c367c1151400f4862c33a5b71744dbfc..2e40e3261c967a1ef4c5b09231fcd593a572b3b2 100644 (file)
@@ -1291,11 +1291,11 @@ that uses or sets the mark."
               "")))
       ;; Read the argument, offering that number (if any) as default.
       (list (read-number (format "Goto%s line%s: "
-                                 (if (= (point-min) 1) ""
-                                   ;; In a narrowed buffer.
-                                   (if relative " relative" " absolute"))
+                                 (if (buffer-narrowed-p)
+                                     (if relative " relative" " absolute")
+                                   "")
                                  buffer-prompt)
-                         (list default (if (or relative (= (point-min) 1))
+                         (list default (if (or relative (not (buffer-narrowed-p)))
                                            (line-number-at-pos)
                                          (save-restriction
                                            (widen)