unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Bochannek <alex@bochannek.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 48683@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	[thread overview]
Message-ID: <m25yyyskxn.fsf@bochannek.com> (raw)
In-Reply-To: <878s3ywadg.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 29 May 2021 04:18:35 +0200")

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

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Alex Bochannek <alex@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?


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

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)

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


-- 
Alex.

  parent reply	other threads:[~2021-05-31 20:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 19:57 bug#48683: 28.0.50; [PATCH] Feature suggestion gnus-summary-toggle-mark-as-processable Alex Bochannek
2021-05-27 23:28 ` 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 [this message]
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=m25yyyskxn.fsf@bochannek.com \
    --to=alex@bochannek.com \
    --cc=48683@debbugs.gnu.org \
    --cc=larsi@gnus.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).