[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gnus: mark-expirable vs. delete

From: Johan Bockgård
Subject: Re: Gnus: mark-expirable vs. delete
Date: Mon, 04 Aug 2003 17:09:12 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (usg-unix-v)

"Joe Casadonte" <address@hidden> 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 

;; 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
    (let ((articles gnus-newsgroup-articles)
      (dolist (article articles)
        (when (eq (gnus-summary-article-mark article)
          (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))))
            ;; why does gnus-summary-work-articles push the marks on the stack?
            (gnus-message 6 "Expunging articles"))
        ;; is (cadr data) always a string?
        (error (gnus-message 3 "%s" (cadr data))))

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

Join us on #emacs @

reply via email to

[Prev in Thread] Current Thread [Next in Thread]