From 109bd7192b5b672508b9fa1d53c10a5a8aec3846 Mon Sep 17 00:00:00 2001 Message-Id: <109bd7192b5b672508b9fa1d53c10a5a8aec3846.1632215537.git.yantar92@gmail.com> In-Reply-To: References: From: Ihor Radchenko Date: Tue, 21 Sep 2021 17:10:10 +0800 Subject: [PATCH 2/2] Honor widen-automatically in help-function-def--button-function * lisp/help-mode.el (help-function-def--button-function): Ask user to widen the buffer when `widen-automatically' is set to nil. --- lisp/help-mode.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 57655db337..5d566ca083 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -263,11 +263,14 @@ help-function-def--button-function (pop-to-buffer (car location)) (run-hooks 'find-function-after-hook) (if position - (progn + (catch :exit ;; Widen the buffer if necessary to go to this position. (when (or (< position (point-min)) (> position (point-max))) - (widen)) + (if (or widen-automatically + (yes-or-no-p "The location is outside narrowing. Widen? ")) + (widen) + (throw :exit nil))) (push-mark nil t) (goto-char position)) (message "Unable to find location in file"))))) -- 2.32.0