summaryrefslogtreecommitdiff
path: root/lisp/gnus
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2010-01-17 18:33:55 -0500
committerChong Yidong <cyd@stupidchicken.com>2010-01-17 18:33:55 -0500
commitb1ea379790b65505005cf2250776cdef9a32acf9 (patch)
treef9b7c085d2b64b2814c2a1738db5ccf7a1e83b58 /lisp/gnus
parentd738d18b5cc598d3f8f6ddd8f1ef85dc101c7f50 (diff)
downloademacs-b1ea379790b65505005cf2250776cdef9a32acf9.tar.gz
* message.el (message-mail): Just pass yank-action on to message-setup.
(message-setup): Handle (FUN . ARGS) form of yank-action. (message-with-reply-buffer, message-widen-reply) (message-yank-original): Handle non-buffer values of message-reply-buffer (Bug#4080).
Diffstat (limited to 'lisp/gnus')
-rw-r--r--lisp/gnus/ChangeLog8
-rw-r--r--lisp/gnus/message.el45
2 files changed, 35 insertions, 18 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index cf4aa383c13..e334ef97244 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,11 @@
+2010-01-17 Chong Yidong <cyd@stupidchicken.com>
+
+ * message.el (message-mail): Just pass yank-action on to message-setup.
+ (message-setup): Handle (FUN . ARGS) form of yank-action.
+ (message-with-reply-buffer, message-widen-reply)
+ (message-yank-original): Handle non-buffer values of
+ message-reply-buffer (Bug#4080).
+
2010-01-17 Juanma Barranquero <lekktu@gmail.com>
* nnmairix.el (nnmairix-group-delete-recreate-this-group):
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index c0886c2051c..c91bcd77195 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -1139,6 +1139,8 @@ If stringp, use this; if non-nil, use no host name (user name only)."
(string :tag "name")
(sexp :tag "none" :format "%t" t)))
+;; This can be the name of a buffer, or a cons cell (FUNCTION . ARGS)
+;; for yanking the original buffer.
(defvar message-reply-buffer nil)
(defvar message-reply-headers nil
"The headers of the current replied article.
@@ -1997,7 +1999,7 @@ see `message-narrow-to-headers-or-head'."
(defmacro message-with-reply-buffer (&rest forms)
"Evaluate FORMS in the reply buffer, if it exists."
- `(when (and message-reply-buffer
+ `(when (and (bufferp message-reply-buffer)
(buffer-name message-reply-buffer))
(with-current-buffer message-reply-buffer
,@forms)))
@@ -3179,7 +3181,7 @@ or in the synonym headers, defined by `message-header-synonyms'."
"Widen the reply to include maximum recipients."
(interactive)
(let ((follow-to
- (and message-reply-buffer
+ (and (bufferp message-reply-buffer)
(buffer-name message-reply-buffer)
(with-current-buffer message-reply-buffer
(message-get-reply-headers t)))))
@@ -3674,9 +3676,16 @@ Really top post? ")))
(point-max)))
(delete-region (message-goto-body) (point-max)))
(set (make-local-variable 'message-cite-reply-above) nil)))
- (delete-windows-on message-reply-buffer t)
+ (if (bufferp message-reply-buffer)
+ (delete-windows-on message-reply-buffer t))
(push-mark (save-excursion
- (insert-buffer-substring message-reply-buffer)
+ (cond
+ ((bufferp message-reply-buffer)
+ (insert-buffer-substring message-reply-buffer))
+ ((and (consp message-reply-buffer)
+ (functionp (car message-reply-buffer)))
+ (apply (car message-reply-buffer)
+ (cdr message-reply-buffer))))
(unless (bolp)
(insert ?\n))
(point)))
@@ -6251,14 +6260,14 @@ between beginning of field and beginning of line."
nil
mua)))
-(defun message-setup (headers &optional replybuffer actions
+;; YANK-ACTION, if non-nil, can be a buffer or a yank action of the
+;; form (FUNCTION . ARGS).
+(defun message-setup (headers &optional yank-action actions
continue switch-function)
(let ((mua (message-mail-user-agent))
- subject to field yank-action)
+ subject to field)
(if (not (and message-this-is-mail mua))
- (message-setup-1 headers replybuffer actions)
- (if replybuffer
- (setq yank-action (list 'insert-buffer replybuffer)))
+ (message-setup-1 headers yank-action actions)
(setq headers (copy-sequence headers))
(setq field (assq 'Subject headers))
(when field
@@ -6275,7 +6284,11 @@ between beginning of field and beginning of line."
(format "%s" (car item))
(cdr item)))
headers)
- continue switch-function yank-action actions)))))
+ continue switch-function
+ (if (bufferp yank-action)
+ (list 'insert-buffer yank-action)
+ yank-action)
+ actions)))))
(defun message-headers-to-generate (headers included-headers excluded-headers)
"Return a list that includes all headers from HEADERS.
@@ -6302,12 +6315,12 @@ are not included."
(push header result)))
(nreverse result)))
-(defun message-setup-1 (headers &optional replybuffer actions)
+(defun message-setup-1 (headers &optional yank-action actions)
(dolist (action actions)
(condition-case nil
(add-to-list 'message-send-actions
`(apply ',(car action) ',(cdr action)))))
- (setq message-reply-buffer replybuffer)
+ (setq message-reply-buffer yank-action)
(goto-char (point-min))
;; Insert all the headers.
(mail-header-format
@@ -6438,7 +6451,7 @@ OTHER-HEADERS is an alist of header/value pairs. CONTINUE says whether
to continue editing a message already being composed. SWITCH-FUNCTION
is a function used to switch to and display the mail buffer."
(interactive)
- (let ((message-this-is-mail t) replybuffer)
+ (let ((message-this-is-mail t))
(unless (message-mail-user-agent)
(message-pop-to-buffer
;; Search for the existing message buffer if `continue' is non-nil.
@@ -6449,15 +6462,11 @@ is a function used to switch to and display the mail buffer."
message-generate-new-buffers)))
(message-buffer-name "mail" to))
switch-function))
- ;; FIXME: message-mail should do something if YANK-ACTION is not
- ;; insert-buffer.
- (and (consp yank-action) (eq (car yank-action) 'insert-buffer)
- (setq replybuffer (nth 1 yank-action)))
(message-setup
(nconc
`((To . ,(or to "")) (Subject . ,(or subject "")))
(when other-headers other-headers))
- replybuffer send-actions continue switch-function)
+ yank-action send-actions continue switch-function)
;; FIXME: Should return nil if failure.
t))