From 0695f5383f67ebbe606e63e5349db63cf650e7da Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 29 Sep 2019 09:56:31 +0200 Subject: [PATCH] Add new Gnus summary commands and keystrokes for "unseen" navigation * doc/misc/gnus.texi (Choosing Commands): Document them. * lisp/gnus/gnus-sum.el (gnus-summary-next-unseen-article) (gnus-summary-prev-unseen-article): New commands and keystrokes (bug#35213). --- doc/misc/gnus.texi | 14 ++++++++++++++ etc/NEWS | 7 +++++++ lisp/gnus/gnus-sum.el | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 4c69c692926..8ab1cf9f68f 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -5347,6 +5347,20 @@ Go to the next article (@code{gnus-summary-next-article}). @findex gnus-summary-prev-article Go to the previous article (@code{gnus-summary-prev-article}). +@item G u +@itemx ] +@kindex ] @r{(Summary)} +@kindex G u @r{(Summary)} +@findex gnus-summary-next-unseen-article +Go to the next unseen article (@code{gnus-summary-next-unseen-article}). + +@item G U +@itemx [ +@kindex [ @r{(Summary)} +@kindex G U @r{(Summary)} +@findex gnus-summary-prev-unseen-article +Go to the previous unseen article (@code{gnus-summary-prev-unseen-article}). + @item G C-n @kindex G C-n @r{(Summary)} @findex gnus-summary-next-same-subject diff --git a/etc/NEWS b/etc/NEWS index 3d8480cb461..f858c958317 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1046,6 +1046,13 @@ Of course it will still find it if you have it in '~/.ecompleterc'. ** Gnus ++++ +*** Two new Gnus summary mode navigation commands have been added, +bound to the '[' and ']' keys: `gnus-summary-prev-unseen-article' and +`gnus-summary-next-unseen-article'. These take you (respectively) to +the previous unseen or next unseen article. (These are the ones that +are marked with "." in the summary mode lines.) + +++ *** The Gnus user variable 'nnimap-expunge' supports three new values: 'never' for never expunging messages, 'immediately' for immediately diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 20f338eda16..b5d744843f0 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -1911,6 +1911,8 @@ increase the score of each group you read." "\M-p" gnus-summary-prev-unread-subject "." gnus-summary-first-unread-article "," gnus-summary-best-unread-article + "[" gnus-summary-prev-unseen-article + "]" gnus-summary-next-unseen-article "\M-s" gnus-summary-search-article-forward "\M-r" gnus-summary-search-article-backward "\M-S" gnus-summary-repeat-search-article-forward @@ -2088,6 +2090,8 @@ increase the score of each group you read." "\M-p" gnus-summary-prev-unread-subject "f" gnus-summary-first-unread-article "b" gnus-summary-best-unread-article + "u" gnus-summary-next-unseen-article + "U" gnus-summary-prev-unseen-article "j" gnus-summary-goto-article "g" gnus-summary-goto-subject "l" gnus-summary-goto-last-article @@ -2796,6 +2800,8 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs)))) ["Previous article same subject" gnus-summary-prev-same-subject t] ["First unread article" gnus-summary-first-unread-article t] ["Best unread article" gnus-summary-best-unread-article t] + ["Next unseen article" gnus-summary-next-unseen-article t] + ["Prev unseen article" gnus-summary-prev-unseen-article t] ["Go to subject number..." gnus-summary-goto-subject t] ["Go to article number..." gnus-summary-goto-article t] ["Go to the last article" gnus-summary-goto-last-article t] @@ -3175,6 +3181,9 @@ The following commands are available: (:type list)) number mark pos header level) +(defun gnus-data-unseen-p (data) + (memq (gnus-data-number data) gnus-newsgroup-unseen)) + (define-inline gnus-data-unread-p (data) (inline-quote (= (gnus-data-mark ,data) gnus-unread-mark))) @@ -8119,6 +8128,32 @@ Return nil if there are no unread articles." (gnus-summary-first-subject t)) (gnus-summary-position-point))) +(defun gnus-summary-next-unseen-article (&optional backward) + "Select the next unseen article." + (interactive) + (let* ((article (gnus-summary-article-number)) + (articles (gnus-data-find-list article (gnus-data-list backward)))) + (when (or (not gnus-summary-check-current) + (not (gnus-data-unseen-p (car articles))) + (not (gnus-data-unread-p (car articles)))) + (setq articles (cdr articles))) + (while (and articles + (or (not (gnus-data-unseen-p (car articles))) + (not (gnus-data-unread-p (car articles))))) + (setq articles (cdr articles))) + (if (not articles) + (if backward + (message "No previous unseen article") + (message "No next unseen article")) + (goto-char (gnus-data-pos (car articles))) + (gnus-summary-select-article) + (gnus-data-number (car articles))))) + +(defun gnus-summary-prev-unseen-article () + "Select the previous unseen article." + (interactive) + (gnus-summary-next-unseen-article t)) + (defun gnus-summary-first-unseen-subject () "Place the point on the subject line of the first unseen article. Return nil if there are no unseen articles." -- 2.39.2