Mercurial > emacs
comparison lisp/mail/pmaildesc.el @ 97920:92a6838937ab
Fix the expunge operation.
pmail.el (pmail-only-expunge): Manage pmail-total-messages in the
callback handler; remove the extra show message call.
(pmail-expunge-callback): Rewrite to handle all possible conditions.
pmaildesc.el (pmail-desc-get-previous, pmail-desc-get-match-index):
New functions.
author | Paul Reilly <pmr@pajato.com> |
---|---|
date | Mon, 01 Sep 2008 08:35:24 +0000 |
parents | 1aab9bdd9355 |
children | 9a4e29eac778 |
comparison
equal
deleted
inserted
replaced
97919:678a47bfb54c | 97920:92a6838937ab |
---|---|
352 (defun pmail-desc-get-month (n) | 352 (defun pmail-desc-get-month (n) |
353 "Return the month (Jan .. Dec) from the date associated with message N." | 353 "Return the month (Jan .. Dec) from the date associated with message N." |
354 (nth pmail-desc-date-month-index | 354 (nth pmail-desc-date-month-index |
355 (nth pmail-desc-date-index (pmail-desc-get-descriptor n)))) | 355 (nth pmail-desc-date-index (pmail-desc-get-descriptor n)))) |
356 | 356 |
357 (defun pmail-desc-get-previous (n attr-index &optional sense) | |
358 "Return the index for the previous matching descriptor. | |
359 Starting with descriptor at index N locate the first previous | |
360 descriptor such that the attribute ATTR is set. SENSE, if | |
361 non-null will reverse the sense of the attribute test." | |
362 (let ((index (1- n)) flag result) | |
363 (while (and (> index 0) (not result)) | |
364 (if (listp (aref pmail-desc-vector index)) | |
365 (setq result (pmail-desc-get-match-index attr-index sense index))) | |
366 (setq index (1- index))) | |
367 (or result 0))) | |
368 | |
369 (defun pmail-desc-get-match-index (attr-index sense n) | |
370 "Return the index N if the associated descriptor has a matching | |
371 attribute, nil otherwise. The attribute value must be set if | |
372 SENSE is nil, or unset if SENSE is non-nil." | |
373 (let (flag (pmail-desc-attr-p attr-index n)) | |
374 (if (or (and flag (not sense)) (and (not flag) sense)) | |
375 n | |
376 nil))) | |
377 | |
357 (defun pmail-desc-get-sender (n) | 378 (defun pmail-desc-get-sender (n) |
358 "Return the User registered as the mail sender." | 379 "Return the User registered as the mail sender." |
359 (nth pmail-desc-sender-index (pmail-desc-get-descriptor n))) | 380 (nth pmail-desc-sender-index (pmail-desc-get-descriptor n))) |
360 | 381 |
361 (defun pmail-desc-get-subject (n) | 382 (defun pmail-desc-get-subject (n) |
393 (defun pmail-desc-prune-deleted-messages (callback) | 414 (defun pmail-desc-prune-deleted-messages (callback) |
394 "Remove all messages marked for marked for deletion. | 415 "Remove all messages marked for marked for deletion. |
395 Return the number of messages removed. Invoke CALLBACK immediately | 416 Return the number of messages removed. Invoke CALLBACK immediately |
396 after a message has been deleted.." | 417 after a message has been deleted.." |
397 | 418 |
398 ;; Set the callback. | 419 ;; Set the callback and remove all messages marked for deletion from |
420 ;; the Pmail buffer and their descriptors from the Pmail message | |
421 ;; vector. | |
399 (setq pmail-desc-delete-callback callback) | 422 (setq pmail-desc-delete-callback callback) |
400 | |
401 ;; Remove all messages marked for deletion from the Pmail buffer and | |
402 ;; their descriptors from the Pmail message vector. | |
403 (let ((result (length (delq t (mapcar 'pmail-desc-delete-maybe | 423 (let ((result (length (delq t (mapcar 'pmail-desc-delete-maybe |
404 (pmail-desc-make-index-list)))))) | 424 (pmail-desc-make-index-list)))))) |
405 (setq pmail-desc-vector | 425 (setq pmail-desc-vector |
406 (vconcat (delq t (append pmail-desc-vector nil)))) | 426 (vconcat (delq t (append pmail-desc-vector nil)))) |
407 result)) | 427 result)) |