From e4ca8f8c2e22decdd215f3738ecf8fd8f532ec52 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 9 Oct 2000 10:28:16 +0000 Subject: [PATCH] (send-mail-item-name): New function. (menu-bar-tools-menu) : 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) : Don't display the "Read Mail" item if read-mail-command is nil or its value is ignore. --- lisp/ChangeLog | 7 +++++++ lisp/menu-bar.el | 21 +++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7f18cf6e500..539faf2e012 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,12 @@ 2000-10-09 Eli Zaretskii + * menu-bar.el (send-mail-item-name): New function. + (menu-bar-tools-menu) : 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) : Don't display the "Read Mail" item + if read-mail-command is nil or its value is ignore. + * mouse.el ([header-line mouse-1]): Bind to mouse-select-window. 2000-10-09 Miles Bader diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 4cbfda6b978..cf342bbab48 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -640,6 +640,19 @@ Do the same for the keys of the same name." ;; 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 @@ Do the same for the keys of the same name." '(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 -- 2.39.5