all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: bojohan@dd.chalmers.se (Johan Bockgård)
Cc: Joe Casadonte <jcasadonte@northbound-train.com>
Subject: Re: Gnus: mark-expirable vs. delete
Date: Mon, 04 Aug 2003 17:09:12 +0200	[thread overview]
Message-ID: <yoijllu9h33b.fsf@frealaf.dd.chalmers.se> (raw)
In-Reply-To: uk7bkg59i.fsf@terrapin.northbound-train.com

"Joe Casadonte" <jcasadonte@northbound-train.com> writes:

> On Mon, 16 Jun 2003, Johan Bockgård wrote:
>
>> Yes, I have thought about this too. It might be nice to have. I
>> think Pine does this--you mark messages for deletion and it deletes
>> them when you exit.
>
> That's exactly what I want!

Only slightly tested:


(defcustom gnus-expungable-mark ?D
  "*Mark used for articles that will be expunged on group exit."
  :group 'gnus-summary-marks
  :type 'character)

(defvar gnus-interactive-expunge 'maybe
  "*If t, require your confirmation before expunging articles. If nil don't ask.
Any other value means to do what `gnus-summary-delete-article' would do
\(ask if `gnus-novice-user' is non-nil).")

(defun gnus-summary-mark-as-expungable (n)
  "Mark next N articles as expungable.
If N is negative, mark backward instead."
  (interactive "p")
  (gnus-summary-mark-forward n gnus-expungable-mark))

(add-hook 'gnus-summary-prepare-exit-hook 'gnus-summary-expunge-expungable-articles)

;; mostly copied from spam-mark-spam-as-expired-and-move-routine in spam.el
(defun gnus-summary-expunge-expungable-articles ()
  (unless gnus-group-is-exiting-without-update-p
    (gnus-summary-kill-process-mark)
    (let ((articles gnus-newsgroup-articles)
	  article
	  todelete)
      (dolist (article articles)
	(when (eq (gnus-summary-article-mark article)
		  gnus-expungable-mark)
	  (push article todelete)))

      ;; now do the actual deletion
      (condition-case data
	  (when todelete
	    (dolist (article todelete)
	      (gnus-summary-set-process-mark article))
	    ;; should we ask before expunging?
	    (let ((gnus-novice-user (cond ((null gnus-interactive-expunge) nil)
					  ((eq gnus-interactive-expunge t) t)
					  (t gnus-novice-user))))
	      (gnus-summary-delete-article))
	    ;; why does gnus-summary-work-articles push the marks on the stack?
	    (gnus-summary-yank-process-mark)
	    (gnus-message 6 "Expunging articles"))
	;; is (cadr data) always a string?
	(error (gnus-message 3 "%s" (cadr data))))
      (gnus-summary-yank-process-mark))))

;;(define-key gnus-summary-mode-map "\C-cd" 'gnus-summary-mark-as-expungable)


-- 
Join us on #emacs @ irc.freenode.net.
http://www.emacswiki.org/cgi-bin/wiki.pl/EmacsChannel

  parent reply	other threads:[~2003-08-04 15:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-13 19:51 Gnus: mark-expirable vs. delete Joe Casadonte
2003-06-13 20:10 ` Johan Bockgård
2003-06-15 15:48   ` Joe Casadonte
2003-06-15 18:55     ` Kai Großjohann
2003-06-17 14:07       ` Joe Casadonte
2003-06-17 14:45         ` Johan Bockgård
2003-06-17 14:50         ` Reiner Steib
2003-06-16  1:03     ` Johan Bockgård
     [not found]       ` <uk7bkg59i.fsf@terrapin.northbound-train.com>
2003-08-04 15:09         ` Johan Bockgård [this message]
2003-06-13 20:23 ` Burton Samograd

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=yoijllu9h33b.fsf@frealaf.dd.chalmers.se \
    --to=bojohan@dd.chalmers.se \
    --cc=jcasadonte@northbound-train.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.