From 9d6d4cabbfabcaf6056a6774516e4eb9d4c2fdde Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 9 Apr 2026 05:53:27 +0300 Subject: [PATCH] Fix "Narrowing src/ file breaks xref" * lisp/emacs-lisp/find-func.el (find-function-C-source): Look outside of the current narrowing as well (bug#80749). --- lisp/emacs-lisp/find-func.el | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 2d89b0f46ec..76b8798ca25 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -302,18 +302,19 @@ TYPE should be nil to find a function, or `defvar' to find a variable." (indirect-function (find-function-advised-original fun-or-var))))) (with-current-buffer (find-file-noselect file) - (goto-char (point-min)) - (unless (re-search-forward - (if type - (concat "DEFVAR[A-Z_]*[ \t\n]*([ \t\n]*\"" - (regexp-quote (symbol-name fun-or-var)) - "\"") - (concat "DEFUN[ \t\n]*([ \t\n]*\"" - (regexp-quote (subr-name (advice--cd*r fun-or-var))) - "\"")) - nil t) - (error "Can't find source for %s" fun-or-var)) - (cons (current-buffer) (match-beginning 0)))) + (without-restriction + (goto-char (point-min)) + (unless (re-search-forward + (if type + (concat "DEFVAR[A-Z_]*[ \t\n]*([ \t\n]*\"" + (regexp-quote (symbol-name fun-or-var)) + "\"") + (concat "DEFUN[ \t\n]*([ \t\n]*\"" + (regexp-quote (subr-name (advice--cd*r fun-or-var))) + "\"")) + nil t) + (error "Can't find source for %s" fun-or-var)) + (cons (current-buffer) (match-beginning 0))))) ;;;###autoload (defun find-library (library)