all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Reitter <david.reitter@gmail.com>
Subject: echo area feedback for minor modes [define-minor-mode patch]
Date: Sat, 22 Apr 2006 16:58:18 +0100	[thread overview]
Message-ID: <DAA88B4C-F453-40A5-9561-953A8E908D30@gmail.com> (raw)

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	other threads:[~2006-04-22 15:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-22 15:58 David Reitter [this message]
2006-04-23 14:14 ` echo area feedback for minor modes [define-minor-mode patch] Stefan Monnier
2006-04-23 21:58 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DAA88B4C-F453-40A5-9561-953A8E908D30@gmail.com \
    --to=david.reitter@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.