changeset 32329:878aee6eaf4b

(send-mail-item-name): New function. (menu-bar-tools-menu) <compose-mail>: Use it to display the value of mail-user-agent in the menu. Don't display the "Send Mail" item if mail-user-agent is nil or its value is ignore. (menu-bar-tools-menu) <rmail>: Don't display the "Read Mail" item if read-mail-command is nil or its value is ignore.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 09 Oct 2000 10:26:22 +0000
parents 66df0c812955
children 7980c067a12b
files lisp/menu-bar.el
diffstat 1 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/menu-bar.el	Mon Oct 09 10:23:49 2000 +0000
+++ b/lisp/menu-bar.el	Mon Oct 09 10:26:22 2000 +0000
@@ -640,6 +640,19 @@
 
 ;; The "Tools" menu items
 
+(defun send-mail-item-name ()
+  (let* ((known-send-mail-commands '((sendmail-user-agent . "sendmail")
+				     (mh-e-user-agent . "MH")
+				     (message-user-agent . "Gnus Message")
+				     (gnus-user-agent . "Gnus")))
+	 (name (assq mail-user-agent known-send-mail-commands)))
+    (if name
+	(setq name (cdr name))
+      (setq name (symbol-name mail-user-agent))
+      (if (string-match "\\(.+\\)-user-agent" name)
+	  (setq name (match-string 1 name))))
+    name))
+
 (defun read-mail-item-name ()
   (let* ((known-rmail-commands '((rmail . "RMAIL")
 				 (mh-rmail . "MH")
@@ -698,14 +711,18 @@
   '(menu-item "Directory Search" eudc-tools-menu
 	      :help "Query directory servers via LDAP, CCSO PH/QI or BBDB"))
 (define-key menu-bar-tools-menu [compose-mail]
-  '(menu-item "Send Mail" compose-mail
-	      :help "Send a mail message"))
+  (list
+   'menu-item `(format "Send Mail (with %s)" (send-mail-item-name))
+   'compose-mail
+   :visible `(and mail-user-agent (not (eq mail-user-agent 'ignore)))
+   :help "Send a mail message"))
 (define-key menu-bar-tools-menu [rmail]
   (list
    'menu-item `(format "Read Mail (with %s)" (read-mail-item-name))
    (lambda ()
      (interactive)
      (call-interactively read-mail-command))
+   :visible `(and read-mail-command (not (eq read-mail-command 'ignore)))
    :help "Read your mail and reply to it"))
 (define-key menu-bar-tools-menu [gnus]
   '(menu-item "Read Net News (Gnus)" gnus