message.el (message-tool-bar-gnome): Tweak tool-bar items. Add :vert-only tags.
authorChong Yidong <cyd@stupidchicken.com>
Fri, 14 Jan 2011 00:30:16 +0000 (00:30 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Fri, 14 Jan 2011 00:30:16 +0000 (00:30 +0000)
 (message-mail): New arg RETURN-ACTION.
 (message-return-action): New var.
 (message-bury): Use it.
 (message-mode): Make it buffer-local.
 (message-send-and-exit): Always call message-bury.

gnus-msg.el (gnus-msg-mail): New arg RETURN-ACTION.  Pass it to message-mail.

lisp/ChangeLog
lisp/gnus-msg.el
lisp/message.el

index af97fb7..8286cdb 100644 (file)
@@ -1,3 +1,16 @@
+2011-01-13  Chong Yidong  <cyd@stupidchicken.com>
+
+       * message.el (message-tool-bar-gnome): Tweak tool-bar items.  Add
+       :vert-only tags.
+       (message-mail): New arg RETURN-ACTION.
+       (message-return-action): New var.
+       (message-bury): Use it.
+       (message-mode): Make it buffer-local.
+       (message-send-and-exit): Always call message-bury.
+
+       * gnus-msg.el (gnus-msg-mail): New arg RETURN-ACTION.  Pass it to
+       message-mail.
+
 2011-01-11  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * nnimap.el (nnimap-convert-partial-article): Protect against
index d66e169..e352ffa 100644 (file)
@@ -477,7 +477,7 @@ Thank you for your help in stamping out bugs.
 
 ;;;###autoload
 (defun gnus-msg-mail (&optional to subject other-headers continue
-                               switch-action yank-action send-actions)
+                     switch-action yank-action send-actions return-action)
   "Start editing a mail message to be sent.
 Like `message-mail', but with Gnus paraphernalia, particularly the
 Gcc: header for archiving purposes."
@@ -486,7 +486,7 @@ Gcc: header for archiving purposes."
        mail-buf)
     (gnus-setup-message 'message
       (message-mail to subject other-headers continue
-                   nil yank-action send-actions))
+                   nil yank-action send-actions return-action))
     (when switch-action
       (setq mail-buf (current-buffer))
       (switch-to-buffer buf)
index e7fe660..1ba4abd 100644 (file)
@@ -1164,6 +1164,8 @@ It is a vector of the following headers:
 (defvar message-checksum nil)
 (defvar message-send-actions nil
   "A list of actions to be performed upon successful sending of a message.")
+(defvar message-return-action nil
+  "Action to return to the caller after sending or postphoning a message.")
 (defvar message-exit-actions nil
   "A list of actions to be performed upon exiting after sending a message.")
 (defvar message-kill-actions nil
@@ -2907,6 +2909,7 @@ M-RET    `message-newline-and-reformat' (break the line and reformat)."
   (set (make-local-variable 'message-reply-buffer) nil)
   (set (make-local-variable 'message-inserted-headers) nil)
   (set (make-local-variable 'message-send-actions) nil)
+  (set (make-local-variable 'message-return-action) nil)
   (set (make-local-variable 'message-exit-actions) nil)
   (set (make-local-variable 'message-kill-actions) nil)
   (set (make-local-variable 'message-postpone-actions) nil)
@@ -3999,11 +4002,9 @@ The text will also be indented the normal way."
        (actions message-exit-actions))
     (when (and (message-send arg)
               (buffer-name buf))
+      (message-bury buf)
       (if message-kill-buffer-on-exit
-         (kill-buffer buf)
-       (bury-buffer buf)
-       (when (eq buf (current-buffer))
-         (message-bury buf)))
+         (kill-buffer buf))
       (message-do-actions actions)
       t)))
 
@@ -4053,9 +4054,8 @@ Instead, just auto-save the buffer and then bury it."
   "Bury this mail BUFFER."
   (let ((newbuf (other-buffer buffer)))
     (bury-buffer buffer)
-    (if (and (window-dedicated-p (selected-window))
-            (not (null (delq (selected-frame) (visible-frame-list)))))
-       (delete-frame (selected-frame))
+    (if message-return-action
+       (apply (car message-return-action) (cdr message-return-action))
       (switch-to-buffer newbuf))))
 
 (defun message-send (&optional arg)
@@ -6348,11 +6348,11 @@ between beginning of field and beginning of line."
 ;; 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)
+                             continue switch-function return-action)
   (let ((mua (message-mail-user-agent))
        subject to field)
     (if (not (and message-this-is-mail mua))
-       (message-setup-1 headers yank-action actions)
+       (message-setup-1 headers yank-action actions return-action)
       (setq headers (copy-sequence headers))
       (setq field (assq 'Subject headers))
       (when field
@@ -6400,11 +6400,12 @@ are not included."
        (push header result)))
     (nreverse result)))
 
-(defun message-setup-1 (headers &optional yank-action actions)
+(defun message-setup-1 (headers &optional yank-action actions return-action)
   (dolist (action actions)
     (condition-case nil
        (add-to-list 'message-send-actions
                     `(apply ',(car action) ',(cdr action)))))
+  (setq message-return-action return-action)
   (setq message-reply-buffer
        (if (and (consp yank-action)
                 (eq (car yank-action) 'insert-buffer))
@@ -6533,9 +6534,9 @@ are not included."
 ;;;
 
 ;;;###autoload
-(defun message-mail (&optional to subject
-                              other-headers continue switch-function
-                              yank-action send-actions)
+(defun message-mail (&optional to subject other-headers continue
+                              switch-function yank-action send-actions
+                              return-action &rest ignored)
   "Start editing a mail message to be sent.
 OTHER-HEADERS is an alist of header/value pairs.  CONTINUE says whether
 to continue editing a message already being composed.  SWITCH-FUNCTION
@@ -6556,7 +6557,8 @@ is a function used to switch to and display the mail buffer."
      (nconc
       `((To . ,(or to "")) (Subject . ,(or subject "")))
       (when other-headers other-headers))
-     yank-action send-actions continue switch-function)
+     yank-action send-actions continue switch-function
+     return-action)
     ;; FIXME: Should return nil if failure.
     t))
 
@@ -7686,24 +7688,22 @@ Pre-defined symbols include `message-tool-bar-gnome' and
 
 (defcustom message-tool-bar-gnome
   '((ispell-message "spell" nil
+                   :vert-only t
                    :visible (or (not (boundp 'flyspell-mode))
                                 (not flyspell-mode)))
     (flyspell-buffer "spell" t
+                    :vert-only t
                     :visible (and (boundp 'flyspell-mode)
                                   flyspell-mode)
                     :help "Flyspell whole buffer")
-    (gmm-ignore "separator")
-    (message-send-and-exit "mail/send")
+    (message-send-and-exit "mail/send" t :label "Send")
     (message-dont-send "mail/save-draft")
-    (message-kill-buffer "close") ;; stock_cancel
-    (mml-attach-file "attach" mml-mode-map)
+    (mml-attach-file "attach" mml-mode-map :vert-only t)
     (mml-preview "mail/preview" mml-mode-map)
     (mml-secure-message-sign-encrypt "lock" mml-mode-map :visible nil)
     (message-insert-importance-high "important" nil :visible nil)
     (message-insert-importance-low "unimportant" nil :visible nil)
-    (message-insert-disposition-notification-to "receipt" nil :visible nil)
-    (gmm-customize-mode "preferences" t :help "Edit mode preferences")
-    (message-info "help" t :help "Message manual"))
+    (message-insert-disposition-notification-to "receipt" nil :visible nil))
   "List of items for the message tool bar (GNOME style).
 
 See `gmm-tool-bar-from-list' for details on the format of the list."