From: Nikolaus Rath <Nikolaus@rath.org>
To: ding@gnus.org, submit@debbugs.gnu.org
Subject: [PATCH] Support hiding deleted IMAP messages
Date: Tue, 26 May 2015 21:29:51 -0700 [thread overview]
Message-ID: <87d21m3ao0.fsf@vostro.rath.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 601 bytes --]
Package: gnus
Tags: patch
Hello,
The attached patch introduces a new server variable,
nnimap-hide-deleted. If non-nil, articles with the IMAP \Deleted flag
will not be included in Summary buffers.
This is intended to increase operability with other IMAP mailreaders and
the new 'never value for nnimap-expunge (see patch in bug 20670).
Thanks for considering.
Best,
-Nikolaus
--
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F
»Time flies like an arrow, fruit flies like a Banana.«
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnimap_hide_deleted.diff --]
[-- Type: text/x-diff, Size: 2915 bytes --]
--- nnimap.el.bak 2015-05-26 19:28:32.453605543 -0700
+++ nnimap.el 2015-05-26 21:10:58.221688253 -0700
@@ -134,6 +134,10 @@
likely value would be \"text/\" to automatically fetch all
textual parts.")
+(defvoo nnimap-hide-deleted nil
+ "If non-nil, articles flagged as deleted (using the IMAP
+\\Delete flag) will not be shown in the Summary buffer.")
+
(defgroup nnimap nil
"IMAP for Gnus."
:group 'gnus)
@@ -180,7 +184,7 @@
(nnimap-find-process-buffer nntp-server-buffer))
(defun nnimap-header-parameters ()
- (format "(UID RFC822.SIZE BODYSTRUCTURE %s)"
+ (format "(UID FLAGS RFC822.SIZE BODYSTRUCTURE %s)"
(format
(if (nnimap-ver4-p)
"BODY.PEEK[HEADER.FIELDS %s]"
@@ -239,12 +243,17 @@
(and (re-search-forward "UID \\([0-9]+\\)" (line-end-position)
t)
(match-string 1)))
- (setq lines nil)
+ (setq flags
+ (and (re-search-forward "FLAGS (\\([^)]+\\))"
+ (line-end-position)
+ t)
+ (split-string (match-string 1))))
(setq size
(and (re-search-forward "RFC822.SIZE \\([0-9]+\\)"
(line-end-position)
t)
(match-string 1)))
+ (setq lines nil)
(beginning-of-line)
(when (search-forward "BODYSTRUCTURE" (line-end-position) t)
(let ((structure (ignore-errors
@@ -258,20 +267,25 @@
(equal (upcase (nth 1 structure)) "RFC822"))
(nth 9 structure)
(nth 7 structure)))))
- (delete-region (line-beginning-position) (line-end-position))
- (insert (format "211 %s Article retrieved." article))
- (forward-line 1)
- (when size
- (insert (format "Chars: %s\n" size)))
- (when lines
- (insert (format "Lines: %s\n" lines)))
- ;; Most servers have a blank line after the headers, but
- ;; Davmail doesn't.
- (unless (re-search-forward "^\r$\\|^)\r?$" nil t)
- (goto-char (point-max)))
- (delete-region (line-beginning-position) (line-end-position))
- (insert ".")
- (forward-line 1)))))
+ (if (and nnimap-hide-deleted
+ (member "\\Deleted" flags))
+ (delete-region (line-beginning-position)
+ (or (re-search-forward "^\r$\\|^)\r?$" nil t)
+ (point-max)))
+ (delete-region (line-beginning-position) (line-end-position))
+ (insert (format "211 %s Article retrieved." article))
+ (forward-line 1)
+ (when size
+ (insert (format "Chars: %s\n" size)))
+ (when lines
+ (insert (format "Lines: %s\n" lines)))
+ ;; Most servers have a blank line after the headers, but
+ ;; Davmail doesn't.
+ (unless (re-search-forward "^\r$\\|^)\r?$" nil t)
+ (goto-char (point-max)))
+ (delete-region (line-beginning-position) (line-end-position))
+ (insert ".")
+ (forward-line 1))))))
(defun nnimap-unfold-quoted-lines ()
;; Unfold quoted {number} strings.
next reply other threads:[~2015-05-27 4:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-27 4:29 Nikolaus Rath [this message]
2015-05-28 13:42 ` Eric Abrahamsen
2015-07-02 2:36 ` [PATCH] Support hiding deleted IMAP messages (v2) Nikolaus Rath
2015-07-02 17:14 ` Andreas Schwab
2017-01-26 19:15 ` bug#20672: " Lars Ingebrigtsen
2020-08-13 8:47 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d21m3ao0.fsf@vostro.rath.org \
--to=nikolaus@rath.org \
--cc=ding@gnus.org \
--cc=submit@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.
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 NNTP newsgroup(s).