Subject: bug#48683: master 16793dc: Add new user option to Gnus to allow `#' to toggle

From: Alex Bochannek <[email-masked]>
Date: Sat, 05 Jun 2021 17:10:42 -0700

Lars Ingebrigtsen <[email-masked]> writes:

> Alex Bochannek <[email-masked]> writes:
>
>>> (And it's not just `#' itself, but the commands to mark regions and such
>>> that are also affected.)
>>
>> That shouldn't be the case. In summary, the gnus-uu-mark functions call
>> the set/remove process mark functions directly and in group/topic I
>> introduced the no-toggle flag to avoid toggling for anything other than
>> `#'.
>
> Ah, OK, then that should be less of a worry...  Perhaps we should try to
> default it to t on the trunk and see whether anybody complains?

Below is the patch to enable it by default.

Change the Gnus default to use `#' to toggle the process mark

* lisp/gnus/gnus.el (gnus-process-mark-toggle): Change default.

* lisp/gnus/gnus-topic.el (gnus-topic-make-menu-bar): Update menu.

* lisp/gnus/gnus-sum.el (gnus-summary-make-menu-bar): Update menu.

* lisp/gnus/gnus-group.el (gnus-group-make-menu-bar): Update menu.

* doc/misc/gnus.texi (Marking Groups, Topic Commands):
(Setting Process Marks, Pick and Read): Document the new default.
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 11bcfc16ae..0ab2aa5b82 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -2583,27 +2583,28 @@ Marking Groups
 @itemx M m
 @kindex M m @r{(Group)}
 @findex gnus-group-mark-group
-Set the mark on the current group (@code{gnus-group-mark-group}).@*
-If @code{gnus-process-mark-toggle} is non-@code{nil}, toggle the
-existing process mark for the current group.
+Toggle the process mark for the current group
+(@code{gnus-group-mark-group}).@*
+If @code{gnus-process-mark-toggle} is @code{nil}, set the process mark
+for the current group.
 
 @item M-#
 @kindex M-# @r{(Group)}
 @itemx M u
 @kindex M u @r{(Group)}
 @findex gnus-group-unmark-group
-Remove the mark from the current group
+Remove the process mark, if any, from the current group
 (@code{gnus-group-unmark-group}).
 
 @item M U
 @kindex M U @r{(Group)}
 @findex gnus-group-unmark-all-groups
-Remove the mark from all groups (@code{gnus-group-unmark-all-groups}).
+Remove the process mark from all groups (@code{gnus-group-unmark-all-groups}).
 
 @item M w
 @kindex M w @r{(Group)}
 @findex gnus-group-mark-region
-Mark all groups between point and mark (@code{gnus-group-mark-region}).
+Mark groups in region (@code{gnus-group-mark-region}).
 
 @item M b
 @kindex M b @r{(Group)}
@@ -4043,11 +4044,11 @@ Topic Commands
 @item T #
 @kindex T # @r{(Topic)}
 @findex gnus-topic-mark-topic
-Mark all groups in the current topic with the process mark
+Toggle the process mark for all groups in the current topic
 (@code{gnus-topic-mark-topic}).  This command works recursively on
 sub-topics unless given a prefix.@*
-If @code{gnus-process-mark-toggle} is non-@code{nil}, toggle the
-existing process mark for the current topic.
+If @code{gnus-process-mark-toggle} is @code{nil}, set the process mark
+for the current topic.
 
 @item T M-#
 @kindex T M-# @r{(Topic)}
@@ -6621,10 +6622,10 @@ Setting Process Marks
 @kindex # @r{(Summary)}
 @kindex M P p @r{(Summary)}
 @findex gnus-summary-mark-as-processable
-Mark the current article with the process mark
+Toggle the process mark for the current article
 (@code{gnus-summary-mark-as-processable}).@*
-If @code{gnus-process-mark-toggle} is non-@code{nil}, toggle the
-existing process mark for the current article.
+If @code{gnus-process-mark-toggle} is @code{nil}, set the process mark
+for the current article.
 
 @item M P u
 @itemx M-#
@@ -10568,15 +10569,15 @@ Pick and Read
 @item .
 @kindex . @r{(Pick)}
 @findex gnus-pick-article-or-thread
-Pick the article or thread on the current line
-(@code{gnus-pick-article-or-thread}).  If the variable
+Pick the article or thread on the current line or unpick it if is
+already picked (@code{gnus-pick-article-or-thread}).  If the variable
 @code{gnus-thread-hide-subtree} is true, then this key selects the
 entire thread when used at the first article of the thread.  Otherwise,
 it selects just the article.  If given a numerical prefix, go to that
 thread or article and pick it.  (The line number is normally displayed
 at the beginning of the summary pick lines.)  If
-@code{gnus-process-mark-toggle} is non-@code{nil}, this key will
-unpick an already picked article.
+@code{gnus-process-mark-toggle} is @code{nil}, this key will pick an
+article or thread.
 
 @item @key{SPC}
 @kindex SPC @r{(Pick)}
diff --git a/etc/NEWS b/etc/NEWS
index 7d53eafbae..e44feff6bb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -871,10 +871,15 @@ tags to be considered as well.
 
 ** Gnus
 
++++
+*** The '#' command in the Group and Summary buffer now toggles,
+instead of sets, the process mark.
+
 +++
 *** New user option 'gnus-process-mark-toggle'.
-If non-nil, the `#' command in the Group and Summary buffers will
-toggle instead of setting the process mark.
+If non-nil (the default), the `#' command in the Group and Summary
+buffers will toggle, instead of set, the process mark.
+
 
 +++
 *** New user option 'gnus-registry-register-all'.
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 06d1313d37..c8b95d9185 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -894,7 +894,7 @@ gnus-group-make-menu-bar
 	["Sort by real name" gnus-group-sort-selected-groups-by-real-name
 	 (not (gnus-topic-mode-p))])
        ("Mark"
-	["Set/Toggle mark" gnus-group-mark-group
+	["Toggle/Set mark" gnus-group-mark-group
 	 (and (gnus-group-group-name)
 	      (not (memq (gnus-group-group-name) gnus-group-marked)))]
 	["Remove mark" gnus-group-unmark-group
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 3279c3221e..bcd76dda29 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -2774,7 +2774,7 @@ gnus-summary-make-menu-bar
 	 ["Hide marked" gnus-summary-limit-exclude-marks t]
 	 ["Show expunged" gnus-summary-limit-include-expunged t])
 	("Process Mark"
-	 ["Set/Toggle mark" gnus-summary-mark-as-processable t]
+	 ["Toggle/Set mark" gnus-summary-mark-as-processable t]
 	 ["Remove mark" gnus-summary-unmark-as-processable t]
 	 ["Remove all marks" gnus-summary-unmark-all-processable t]
 	 ["Invert marks" gnus-uu-invert-processable t]
diff --git a/lisp/gnus/gnus-topic.el b/lisp/gnus/gnus-topic.el
index c0484622f4..b974dff372 100644
--- a/lisp/gnus/gnus-topic.el
+++ b/lisp/gnus/gnus-topic.el
@@ -1112,7 +1112,7 @@ gnus-topic-make-menu-bar
 	["Delete" gnus-topic-delete t]
 	["Rename..." gnus-topic-rename t]
 	["Create..." gnus-topic-create-topic t]
-	["Set/Toggle mark" gnus-topic-mark-topic t]
+	["Toggle/Set mark" gnus-topic-mark-topic t]
 	["Indent" gnus-topic-indent t]
 	["Sort" gnus-topic-sort-topics t]
 	["Previous topic" gnus-topic-goto-previous-topic t]
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 21b5f31c14..7dde799a5b 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -1183,8 +1183,8 @@ gnus-process-mark
   :group 'gnus-summary-marks
   :type 'character)
 
-(defcustom gnus-process-mark-toggle nil
-  "If non-nil the process mark command toggles the process mark."
+(defcustom gnus-process-mark-toggle t
+  "If nil the process mark command only sets the process mark."
   :version "28.1"
   :group 'gnus-summary
   :group 'gnus-group-various
-- 
Alex.