changeset 106938:cfd4986edb0b

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Mon, 18 Jan 2010 04:43:39 +0000
parents bb56b4800dcb (current diff) fb36a68f9d48 (diff)
children beaca50ab7dd
files
diffstat 4 files changed, 55 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Jan 17 23:32:40 2010 +0000
+++ b/lisp/ChangeLog	Mon Jan 18 04:43:39 2010 +0000
@@ -1,3 +1,8 @@
+2010-01-17  Chong Yidong  <cyd@stupidchicken.com>
+
+	* mail/sendmail.el (mail-yank-original): Set the mark if the
+	specified function for yanking does not do it.
+
 2010-01-17  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* vc.el (with-vc-properties): Deal with directory arguments.  (Bug#5298)
@@ -91,7 +96,7 @@
 2010-01-15  Kenichi Handa  <handa@m17n.org>
 
 	* international/mule-cmds.el (canonicalize-coding-system-name):
-	Convert "msXXX", "ibmXXX", "windows-XXX" to "cpXXX".
+	Convert "msXXX", "ibmXXX", "windows-XXX" to "cpXXX" (Bug#5387).
 
 2010-01-15  Glenn Morris  <rgm@gnu.org>
 
--- a/lisp/gnus/ChangeLog	Sun Jan 17 23:32:40 2010 +0000
+++ b/lisp/gnus/ChangeLog	Mon Jan 18 04:43:39 2010 +0000
@@ -1,3 +1,12 @@
+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).
+	(message-setup-1): Prefer to save message-reply-buffer as a buffer.
+
 2010-01-17  Juanma Barranquero  <lekktu@gmail.com>
 
 	* nnmairix.el (nnmairix-group-delete-recreate-this-group):
--- a/lisp/gnus/message.el	Sun Jan 17 23:32:40 2010 +0000
+++ b/lisp/gnus/message.el	Mon Jan 18 04:43:39 2010 +0000
@@ -1139,6 +1139,8 @@
 		 (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 @@
 
 (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 @@
   "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 @@
 				      (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 @@
 	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 @@
 				 (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,16 @@
 	(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
+	(if (and (consp yank-action)
+		 (eq (car yank-action) 'insert-buffer))
+	    (nth 1 yank-action)
+	  yank-action))
   (goto-char (point-min))
   ;; Insert all the headers.
   (mail-header-format
@@ -6438,7 +6455,7 @@
 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 +6466,11 @@
 		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))
 
--- a/lisp/mail/sendmail.el	Sun Jan 17 23:32:40 2010 +0000
+++ b/lisp/mail/sendmail.el	Mon Jan 18 04:43:39 2010 +0000
@@ -1505,14 +1505,18 @@
   (interactive "P")
   (if mail-reply-action
       (let ((start (point))
-	    (original mail-reply-action))
+	    (original mail-reply-action)
+	    (omark (mark t)))
 	(and (consp original) (eq (car original) 'insert-buffer)
 	     (setq original (nth 1 original)))
 	(if (consp original)
-	    (apply (car original) (cdr original))
-	  ;; If the original message is in another window in the same frame,
-	  ;; delete that window to save screen space.
-	  ;; t means don't alter other frames.
+	    (progn
+	      ;; Call yank function, and set the mark if it doesn't.
+	      (apply (car original) (cdr original))
+	      (if (eq omark (mark t))
+		  (push-mark (point))))
+	  ;; If the original message is in another window in the same
+	  ;; frame, delete that window to save space.
 	  (delete-windows-on original t)
 	  (with-no-warnings
 	    ;; We really want this to set mark.