[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp/mail pmail.el
From: |
Richard M. Stallman |
Subject: |
[Emacs-diffs] emacs/lisp/mail pmail.el |
Date: |
Mon, 22 Dec 2008 21:16:44 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Richard M. Stallman <rms> 08/12/22 21:16:44
Modified files:
lisp/mail : pmail.el
Log message:
(pmail-retried-attr-index, pmail-forwarded-attr-index):
Renamed from pmail-resent-attr-index and pmail-stored-attr-index.
(pmail-attr-array): Change names to `retried' and `forwarded'
(pmail-get-header): Don't unswap, just look at the data where it is.
(pmail-set-attribute): Don't unswap, just set the data where it is.
(pmail-reply): Use pmail-answered-attr-index.
(pmail-forward): Use pmail-forwarded-attr-index.
(pmail-retry-failure): Use pmail-retried-attr-index.
(pmail-show-message): Call pmail-swap-buffers-maybe before reswapping.
(pmail-get-attr-names): Doc fix.
(pmail-is-text-p): Doc fix.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/mail/pmail.el?cvsroot=emacs&r1=1.38&r2=1.39
Patches:
Index: pmail.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mail/pmail.el,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- pmail.el 22 Dec 2008 19:54:59 -0000 1.38
+++ pmail.el 22 Dec 2008 21:16:43 -0000 1.39
@@ -61,10 +61,10 @@
(defconst pmail-filed-attr-index 3
"The index for the `filed' attribute.")
-(defconst pmail-resent-attr-index 4
- "The index for the `resent' attribute.")
+(defconst pmail-retried-attr-index 4
+ "The index for the `retried' attribute.")
-(defconst pmail-stored-attr-index 5
+(defconst pmail-forwarded-attr-index 5
"The index for the `stored' attribute.")
(defconst pmail-unseen-attr-index 6
@@ -75,8 +75,8 @@
(?D "deleted")
(?E "edited")
(?F "filed")
- (?R "replied")
- (?S "stored")
+ (?R "retried")
+ (?S "forwarded")
(?U "unseen")]
"An array that provides a mapping between an attribute index,
its character representation and its display representation.")
@@ -2037,30 +2037,33 @@
;;;; *** Pmail Attributes and Keywords ***
-(defun pmail-get-header (name &optional msg)
- "Return the value of message header NAME, nil if no such header
-exists. MSG, if set identifies the message number to use. The
-current mail message will be used otherwise."
- (pmail-swap-buffers-maybe)
+(defun pmail-get-header (name &optional msgnum)
+ "Return the value of message header NAME, nil if it has none.
+MSGNUM specifies the message number to get it from.
+If MSGNUM is nil, use the current message."
+ (with-current-buffer pmail-buffer
+ (or msgnum (setq msgnum pmail-current-message))
+ (when (> msgnum 0)
+ (let (msgbeg end)
+ (setq msgbeg (pmail-msgbeg msgnum))
(save-excursion
+ (if (pmail-buffers-swapped-p) (set-buffer pmail-view-buffer))
(save-restriction
- (with-current-buffer pmail-buffer
(widen)
- (let* ((n (or msg pmail-current-message))
- (beg (pmail-msgbeg n))
- end)
- (goto-char beg)
+ (save-excursion
+ (goto-char msgbeg)
(setq end (search-forward "\n\n" nil t))
(if end
(progn
- (narrow-to-region beg end)
+ (narrow-to-region msgbeg end)
(mail-fetch-field name))
- (pmail-error-bad-format msg)))))))
+ (pmail-error-bad-format msgnum)))))))))
+
(defun pmail-get-attr-names (&optional msg)
"Return the message attributes in a comma separated string.
-MSG, if set identifies the message number to use. The current
-mail message will be used otherwise."
+MSG specifies the message number to get it from.
+If MSG is nil, use the current message."
(let ((value (pmail-get-header pmail-attribute-header msg))
result temp)
(dotimes (index (length value))
@@ -2120,20 +2123,27 @@
with the state (nil represents off and non-nil represents on).
ATTR is the index of the attribute. MSGNUM is message number to
change; nil means current message."
- (set-buffer pmail-buffer)
- (pmail-swap-buffers-maybe)
+ (with-current-buffer pmail-buffer
(let ((value (pmail-get-attr-value attr state))
(omax (point-max-marker))
(omin (point-min-marker))
(buffer-read-only nil)
- limit)
+ limit
+ msgbeg)
(or msgnum (setq msgnum pmail-current-message))
- (if (> msgnum 0)
+ (when (> msgnum 0)
+ (if (= attr pmail-deleted-attr-index)
+ (pmail-set-message-deleted-p msgnum state))
+ (setq msgbeg (pmail-msgbeg msgnum))
+
(unwind-protect
(save-excursion
- ;; Determine if the current state is the desired state.
+ (if (pmail-buffers-swapped-p) (set-buffer pmail-view-buffer))
+ (save-restriction
(widen)
- (goto-char (pmail-msgbeg msgnum))
+ (save-excursion
+ ;; Determine if the current state is the desired state.
+ (goto-char msgbeg)
(save-excursion
(setq limit (search-forward "\n\n" nil t)))
(if (search-forward (concat pmail-attribute-header ": ") limit t)
@@ -2144,17 +2154,9 @@
(let ((header-value "-------"))
(aset header-value attr value)
(goto-char (if limit (- limit 1) (point-max)))
- (insert pmail-attribute-header ": " header-value "\n")))
- (if (= attr pmail-deleted-attr-index)
- (pmail-set-message-deleted-p msgnum state)))
- ;; Note: we don't use save-restriction because that does not work
right
- ;; if changes are made outside the saved restriction
- ;; before that restriction is restored.
- (narrow-to-region omin omax)
- (set-marker omin nil)
- (set-marker omax nil)
+ (insert pmail-attribute-header ": " header-value
"\n"))))))
(if (= msgnum pmail-current-message)
- (pmail-display-labels))))))
+ (pmail-display-labels)))))))
(defun pmail-message-attr-p (msg attrs)
"Return t if the attributes header for message MSG contains a
@@ -2472,8 +2474,7 @@
(message blurb))))
(defun pmail-is-text-p ()
- "Return t if the region contains a text message, nil
-otherwise."
+ "Return t if the region contains a text message, nil otherwise."
(save-excursion
(let ((text-regexp "\\(text\\|message\\)/")
(content-type-header (mail-fetch-field "content-type")))
@@ -2506,6 +2507,7 @@
;; Mark the message as seen, bracket the message in the mail
;; buffer and determine the coding system the transfer encoding.
(pmail-set-attribute pmail-unseen-attr-index nil)
+ (pmail-swap-buffers-maybe)
(setq beg (pmail-msgbeg msg)
end (pmail-msgend msg))
(widen)
@@ -3259,7 +3261,7 @@
pmail-buffer
(with-current-buffer pmail-buffer
(aref pmail-msgref-vector msgnum))
- "answered"))
+ pmail-answered-attr-index))
nil
(list (cons "References" (concat (mapconcat 'identity references " ")
" " message-id))))))
@@ -3356,7 +3358,7 @@
forward-buffer
(with-current-buffer pmail-buffer
(aref pmail-msgref-vector msgnum))
- "forwarded"))
+ pmail-forwarded-attr-index))
;; If only one window, use it for the mail buffer.
;; Otherwise, use another window for the mail buffer
;; so that the Pmail buffer remains visible
@@ -3584,7 +3586,7 @@
(list (list 'pmail-mark-message
pmail-this-buffer
(aref pmail-msgref-vector msgnum)
- "retried")))
+ pmail-retried-attr-index)))
;; Insert original text as initial text of new draft message.
;; Bind inhibit-read-only since the header delimiter
;; of the previous message was probably read-only.
- [Emacs-diffs] emacs/lisp/mail pmail.el, (continued)
- [Emacs-diffs] emacs/lisp/mail pmail.el, Chong Yidong, 2008/12/10
- [Emacs-diffs] emacs/lisp/mail pmail.el, Chong Yidong, 2008/12/12
- [Emacs-diffs] emacs/lisp/mail pmail.el, Chong Yidong, 2008/12/15
- [Emacs-diffs] emacs/lisp/mail pmail.el, Chong Yidong, 2008/12/15
- [Emacs-diffs] emacs/lisp/mail pmail.el, Chong Yidong, 2008/12/19
- [Emacs-diffs] emacs/lisp/mail pmail.el, Chong Yidong, 2008/12/19
- [Emacs-diffs] emacs/lisp/mail pmail.el, Chong Yidong, 2008/12/20
- [Emacs-diffs] emacs/lisp/mail pmail.el, Chong Yidong, 2008/12/20
- [Emacs-diffs] emacs/lisp/mail pmail.el, Chong Yidong, 2008/12/21
- [Emacs-diffs] emacs/lisp/mail pmail.el, Richard M. Stallman, 2008/12/22
- [Emacs-diffs] emacs/lisp/mail pmail.el,
Richard M. Stallman <=
- [Emacs-diffs] emacs/lisp/mail pmail.el, Richard M. Stallman, 2008/12/22
- [Emacs-diffs] emacs/lisp/mail pmail.el, Richard M. Stallman, 2008/12/22
- [Emacs-diffs] emacs/lisp/mail pmail.el, Richard M. Stallman, 2008/12/29
- [Emacs-diffs] emacs/lisp/mail pmail.el, Chong Yidong, 2008/12/30