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: 48683 <at> debbugs.gnu.org
Subject: bug#48683: 28.0.50; [PATCH] Feature suggestion gnus-summary-toggle-mark-as-processable
Date: Wed, 26 May 2021 12:57:06 -0700
[Message part 1 (text/plain, inline)]
(Not sure if bug-gnu-emacs is the right place to send things like this,
please let me know if there is a better list.)

I have been missing a article process mark toggle for a while and would
like to propose the below patch. If "+" is not an appropriate key to use
for this, I am happy to accept an alternative.

[Message part 2 (text/x-patch, inline)]
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 7d6fa4cb5c..2862faadf0 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -6628,6 +6628,13 @@ Setting Process Marks
 Remove the process mark, if any, from the current article
 (@code{gnus-summary-unmark-as-processable}).
 
+@item M P +
+@itemx +
+@kindex M P + @r{(Summary)}
+@kindex + @r{(Summary)}
+Toggle the process mark of the current article
+(@code{gnus-summary-toggle-mark-as-processable}).
+
 @item M P U
 @kindex M P U @r{(Summary)}
 @findex gnus-summary-unmark-all-processable
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index aa4c753287..93ea117ff1 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -1948,6 +1948,7 @@ gnus-summary-mode-map
   "e" gnus-summary-edit-article
   "#" gnus-summary-mark-as-processable
   "\M-#" gnus-summary-unmark-as-processable
+  "+" gnus-summary-toggle-mark-as-processable
   "\M-\C-t" gnus-summary-toggle-threads
   "\M-\C-s" gnus-summary-show-thread
   "\M-\C-h" gnus-summary-hide-thread
@@ -2046,6 +2047,7 @@ gnus-summary-mode-map
   "B" gnus-summary-remove-bookmark
   "#" gnus-summary-mark-as-processable
   "\M-#" gnus-summary-unmark-as-processable
+  "+" gnus-summary-toggle-mark-as-processable
   "S" gnus-summary-limit-include-expunged
   "C" gnus-summary-catchup
   "H" gnus-summary-catchup-to-here
@@ -2336,6 +2338,7 @@ gnus-summary-mode-map
 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
   "p" gnus-summary-mark-as-processable
   "u" gnus-summary-unmark-as-processable
+  "+" gnus-summary-toggle-mark-as-processable
   "U" gnus-summary-unmark-all-processable
   "v" gnus-uu-mark-over
   "s" gnus-uu-mark-series
@@ -2776,6 +2779,7 @@ gnus-summary-make-menu-bar
 	("Process Mark"
 	 ["Set mark" gnus-summary-mark-as-processable t]
 	 ["Remove mark" gnus-summary-unmark-as-processable t]
+	 ["Toggle mark" gnus-summary-toggle-mark-as-processable t]
 	 ["Remove all marks" gnus-summary-unmark-all-processable t]
 	 ["Invert marks" gnus-uu-invert-processable t]
 	 ["Mark above" gnus-uu-mark-over t]
@@ -10951,10 +10955,15 @@ 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)))
+		(cond ((eq nil unmark)
+		       (gnus-summary-set-process-mark article))
+		      ((eq t unmark)
+		       (gnus-summary-remove-process-mark article))
+		      ((eq 'toggle unmark)
+		       (if (memq article gnus-newsgroup-processable)
+			   (gnus-summary-remove-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)
@@ -10970,6 +10979,13 @@ gnus-summary-unmark-as-processable
   (interactive "P" gnus-summary-mode)
   (gnus-summary-mark-as-processable n t))
 
+(defun gnus-summary-toggle-mark-as-processable (n)
+  "Toggle the process mark from the next N articles.
+If N is negative, toggle mark backward instead.  The difference between
+N and the actual number of articles with their mark toggled is returned."
+  (interactive "P" gnus-summary-mode)
+  (gnus-summary-mark-as-processable n 'toggle))
+
 (defun gnus-summary-unmark-all-processable ()
   "Remove the process mark from all articles."
   (interactive nil gnus-summary-mode)
[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.