From 635b8cab71d9f296bdef68dafd1d124213b777c2 Mon Sep 17 00:00:00 2001 Message-Id: <635b8cab71d9f296bdef68dafd1d124213b777c2.1633078979.git.yantar92@gmail.com> From: Ihor Radchenko Date: Fri, 1 Oct 2021 17:02:06 +0800 Subject: [PATCH] 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 d61b1bdc62..2132a143c7 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -268,11 +268,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))) ;; Save mark for the old location, unless the point is not ;; actually going to move. (unless (= (point) position) -- 2.32.0