unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Bochannek <alex@bochannek.com>
To: 48683@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	[thread overview]
Message-ID: <m2k0nlfeul.fsf@bochannek.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

(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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 3468 bytes --]

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)

[-- Attachment #3: Type: text/plain, Size: 11 bytes --]


-- 
Alex.

             reply	other threads:[~2021-05-26 19:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 19:57 Alex Bochannek [this message]
2021-05-27 23:28 ` bug#48683: 28.0.50; [PATCH] Feature suggestion gnus-summary-toggle-mark-as-processable Lars Ingebrigtsen
2021-05-28  0:13   ` Jose A. Ortega Ruiz
2021-05-28  2:07     ` Eric Abrahamsen
2021-05-28  2:16       ` Lars Ingebrigtsen
2021-05-28  2:29         ` Eric Abrahamsen
2021-05-28 17:39         ` Jose A. Ortega Ruiz
2021-05-28  2:04   ` Alex Bochannek
2021-05-29  2:18     ` Lars Ingebrigtsen
2021-05-29 16:59       ` Eric Abrahamsen
2021-05-30  4:32         ` Lars Ingebrigtsen
2021-05-31 20:33       ` Alex Bochannek
2021-06-01  6:23         ` Lars Ingebrigtsen
2021-06-01 15:57           ` Alex Bochannek
2021-06-01 20:45           ` Alex Bochannek
2021-06-02  5:42             ` Lars Ingebrigtsen
2021-06-02  6:35               ` Alex Bochannek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2k0nlfeul.fsf@bochannek.com \
    --to=alex@bochannek.com \
    --cc=48683@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).