Path: utzoo!mnetor!uunet!husc6!mit-eddie!YALE.ARPA!ram-ashwin From: ram-ashwin@YALE.ARPA (Ashwin Ram) Newsgroups: comp.emacs Subject: Re: Subject search in RMAIL Message-ID: <8712091612.AA01353@ATHENA.CS.YALE.EDU> Date: 9 Dec 87 16:12:52 GMT Sender: daemon@eddie.MIT.EDU Lines: 41 There was a small bug in the definition of rmail-kill-subject, which appeared only when this function was called non-interactively. The corrected code follows. (rmail-subject-search is the same function as before.) (defun rmail-kill-subject (subject) "Kills all following messages matching the regular expression SUBJECT, which defaults to the subject of the current message. (This is like the 'k' command of rn(1).)" (interactive (list (concat "^\\(Re: *\\|\\)" (regexp-quote (rmail-deReify (or (mail-fetch-field "Subject") (error "Current message has no subject")))) "$"))) (let ((start rmail-current-message) (deleted '()) (next (rmail-subject-search subject))) (cond ((let ((current-subject (save-excursion (save-restriction (widen) (narrow-to-region (rmail-msgbeg start) (rmail-msgend start)) (mail-fetch-field "Subject"))))) (and current-subject (string-match subject current-subject))) (rmail-delete-message) (setq deleted (cons start deleted)))) (while next (rmail-show-message next) (rmail-delete-message) (setq deleted (cons rmail-current-message deleted)) (setq next (rmail-subject-search subject))) (rmail-show-message start) (rmail-next-undeleted-message 1) (if deleted (message "Deleted %s messages %s" (length deleted) (reverse deleted)) (message "No nondeleted messages with subject %s" (if (interactive-p) (rmail-deReify (mail-fetch-field "Subject")) subject))))) -- Ashwin Ram -- ARPA: Ram-Ashwin@cs.yale.edu UUCP: {decvax,linus,seismo}!yale!Ram-Ashwin BITNET: Ram@yalecs