GNU bug report logs - #48683
28.0.50; [PATCH] Feature suggestion gnus-summary-toggle-mark-as-processable

Previous Next

Package: emacs;

Reported by: Alex Bochannek <alex <at> bochannek.com>

Date: Wed, 26 May 2021 19:58:02 UTC

Severity: normal

Tags: patch

Found in version 28.0.50

Fixed in version 28.1

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alex Bochannek <alex <at> bochannek.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 48683 <at> debbugs.gnu.org
Subject: bug#48683: 28.0.50; [PATCH] Feature suggestion gnus-summary-toggle-mark-as-processable
Date: Mon, 31 May 2021 13:33:08 -0700
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Alex Bochannek <alex <at> bochannek.com> writes:
>
>> I can absolutely use `#' and `M-#`, but switching between
>> the two quickly when going through dozens of messages requires a fair
>> amount of dexterity.
>
> It seems like many people would prefer to have the `#' command be a
> toggle.  Perhaps we should just add a user option to have `#' toggle or
> not?  (Defaulting to "not toggle" for backwards compatibility.)

How about something like this?

[Message part 2 (text/x-patch, inline)]
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 7d6fa4cb5c..b9c6952d60 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -6618,13 +6618,15 @@ Setting Process Marks
 @kindex M P p @r{(Summary)}
 @findex gnus-summary-mark-as-processable
 Mark the current article with the process mark
-(@code{gnus-summary-mark-as-processable}).
-@findex gnus-summary-unmark-as-processable
+(@code{gnus-summary-mark-as-processable}).@*
+If @code{gnus-summary-process-mark-toggle} is non-nil, toggle the
+existing process mark for the current article.
 
 @item M P u
 @itemx M-#
 @kindex M P u @r{(Summary)}
 @kindex M-# @r{(Summary)}
+@findex gnus-summary-unmark-as-processable
 Remove the process mark, if any, from the current article
 (@code{gnus-summary-unmark-as-processable}).
 
@@ -10569,6 +10571,8 @@ Pick and Read
 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-summary-process-mark-toggle} is non-nil, this key will
+unpick an already picked article.
 
 @item @key{SPC}
 @kindex SPC @r{(Pick)}
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index aa4c753287..941cbaa7d1 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -562,6 +562,12 @@ gnus-move-group-prefix-function
   :group 'gnus-summary-mail
   :type 'function)
 
+(defcustom gnus-summary-process-mark-toggle nil
+  "If non-nil the process mark command toggles the article's mark."
+  :version "28.1"
+  :group 'gnus-summary
+  :type 'boolean)
+
 ;; FIXME: Although the custom type is `character' for the following variables,
 ;; using multibyte characters (Latin-1, UTF-8) doesn't work.  -- rs
 
@@ -2774,7 +2780,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 mark" gnus-summary-mark-as-processable t]
+	 ["Set/Toggle 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]
@@ -10951,10 +10957,14 @@ gnus-summary-mark-as-processable
 	  (n (abs n)))
       (while (and
 	      (> n 0)
-	      (if unmark
-		  (gnus-summary-remove-process-mark
-		   (gnus-summary-article-number))
-		(gnus-summary-set-process-mark (gnus-summary-article-number)))
+	      (let ((article (gnus-summary-article-number)))
+		(if (eq t unmark)
+		    (gnus-summary-remove-process-mark article)
+		  (if (eq t gnus-summary-process-mark-toggle)
+		      (if (memq article gnus-newsgroup-processable)
+			  (gnus-summary-remove-process-mark article)
+			(gnus-summary-set-process-mark article))
+		    (gnus-summary-set-process-mark article))))
 	      (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
 	(setq n (1- n)))
       (when (/= 0 n)
[Message part 3 (text/plain, inline)]
-- 
Alex.

This bug report was last modified 3 years and 352 days ago.

Previous Next


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