GNU bug report logs - #44202
[PATCH] Add variable to control confirmation of help-mode-revert-buffer

Previous Next

Package: emacs;

Reported by: Kevin Foley <kevin <at> kevinjfoley.me>

Date: Sat, 24 Oct 2020 23:13:01 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 44202 <at> debbugs.gnu.org (full text, mbox):

From: Kevin Foley <kevin <at> kevinjfoley.me>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Stefan Kangas <stefan <at> marxist.se>, Drew Adams <drew.adams <at> oracle.com>,
 44202 <at> debbugs.gnu.org
Subject: Re: bug#44202: [PATCH] Add variable to control confirmation of
 help-mode-revert-buffer
Date: Sun, 25 Oct 2020 10:47:20 -0400
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

>> +(defcustom help-mode-revert-buffer-noconfirm nil
>
> In general, I think "negative" variables should be avoided, because
> doing the "not not" logic confuses people.  So I'd rather have
> `help-mode-revert-buffer-confirm' (defaulting to t).

I was trying to match the noconfirm argument of the revert function but
I agree, `help-mode-revert-buffer-confirm' is less confusing.

I've attached an updated patch.

Kevin Foley

[0001-Add-option-to-disable-confirmation-prompt-when-rever.patch (text/x-patch, inline)]
From 9d5c29fc084d13837a5e8fb27f3948953b923605 Mon Sep 17 00:00:00 2001
From: "Kevin J. Foley" <kevin <at> kevinjfoley.me>
Date: Sat, 24 Oct 2020 16:14:31 -0400
Subject: [PATCH] Add option to disable confirmation prompt when reverting help
 buffer

    * lisp/help-mode.el (help-mode-revert-buffer-confirm):
    (help-mode-revert-buffer): Add variable and reference it in revert
    function.
---
 lisp/help-mode.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 0dc6c9ffae..716924f312 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -98,6 +98,12 @@ The format is (FUNCTION ARGS...).")
   "Hook run by `help-mode'."
   :type 'hook
   :group 'help)
+
+(defcustom help-mode-revert-buffer-confirm t
+  "Non-nil means prompt for confirmation when reverting a help buffer."
+  :type 'boolean
+  :group 'help
+  :version "28.1")
 
 ;; Button types used by help
 
@@ -757,7 +763,11 @@ Show all docs for that symbol as either a variable, function or face."
       (user-error "No symbol here"))))
 
 (defun help-mode-revert-buffer (_ignore-auto noconfirm)
-  (when (or noconfirm (yes-or-no-p "Revert help buffer? "))
+  "Revert help-mode buffer.
+See `help-mode-revert-buffer-confirm' to control confirmation prompt."
+  (when (or noconfirm
+            (not help-mode-revert-buffer-confirm)
+            (yes-or-no-p "Revert help buffer? "))
     (let ((pos (point))
 	  (item help-xref-stack-item)
 	  ;; Pretend there is no current item to add to the history.
-- 
2.28.0


This bug report was last modified 4 years and 177 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.