emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

echo area feedback for minor modes [define-minor-mode patch]


From: David Reitter
Subject: echo area feedback for minor modes [define-minor-mode patch]
Date: Sat, 22 Apr 2006 16:58:18 +0100

Selecting the following menu items from the Options menu brings up an echo area message ".... enabled/disabled": "truncate long lines..", "word wrap...", "Case-Insensitive..", " ...CUA", "Debugger on error" and others.

That's good and helpful.

However, for some other entries, I am just getting a key binding path such as "menu-bar options transient-mark-mode". These entries are

- transient-mark-mode ("Active Region Highlighting")
- highlight-paren-mode
- blink-cursor-mode
- show/hide -> tool-bar-mode
- maybe others.

These are implemented as minor modes defined via `define-minor-mode'.

The bug is due to the fact that this macro doesn't show a message unless the echo area is empty - it is not, however, due to the (needless) previous output of the path to the menu item ("
menu-bar options transient-mark-mode").

I'm not sure, but I assume this behavior could be in order to allow any minor mode body to display its own message. If that's so, the below patch will allow minor modes to display the default message whenever the body doesn't show a new echo area message.




*** lisp/emacs-lisp/easy-mmode.el       22 Feb 2006 19:15:31 +0000      1.74
--- lisp/emacs-lisp/easy-mmode.el       22 Apr 2006 16:51:22 +0100      
***************
*** 139,145 ****
      (setq body (list* lighter keymap body) lighter nil keymap nil))
     ((keywordp keymap) (push keymap body) (setq keymap nil)))

!   (let* ((mode-name (symbol-name mode))
         (pretty-name (easy-mmode-pretty-mode-name mode lighter))
         (globalp nil)
         (set nil)
--- 139,146 ----
      (setq body (list* lighter keymap body) lighter nil keymap nil))
     ((keywordp keymap) (push keymap body) (setq keymap nil)))

!   (let* ((last-message (current-message))
!        (mode-name (symbol-name mode))
         (pretty-name (easy-mmode-pretty-mode-name mode lighter))
         (globalp nil)
         (set nil)
***************
*** 236,242 ****
         (if (called-interactively-p)
             (progn
               ,(if globalp `(customize-mark-as-set ',mode))
!              (unless (current-message)
                 (message ,(format "%s %%sabled" pretty-name)
                          (if ,mode "en" "dis")))))
         (force-mode-line-update)
--- 237,246 ----
         (if (called-interactively-p)
             (progn
               ,(if globalp `(customize-mark-as-set ',mode))
!              ;; avoid overwriting a message shown by the body,
!              ;; but do overwrite previous messages
!              (unless  ,(and (current-message)
!                            (not (equal last-message (current-message))))
                 (message ,(format "%s %%sabled" pretty-name)
                          (if ,mode "en" "dis")))))
         (force-mode-line-update)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]