unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* echo area feedback for minor modes [define-minor-mode patch]
@ 2006-04-22 15:58 David Reitter
  2006-04-23 14:14 ` Stefan Monnier
  2006-04-23 21:58 ` Richard Stallman
  0 siblings, 2 replies; 3+ messages in thread
From: David Reitter @ 2006-04-22 15:58 UTC (permalink / 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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: echo area feedback for minor modes [define-minor-mode patch]
  2006-04-22 15:58 echo area feedback for minor modes [define-minor-mode patch] David Reitter
@ 2006-04-23 14:14 ` Stefan Monnier
  2006-04-23 21:58 ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2006-04-23 14:14 UTC (permalink / raw)
  Cc: Emacs-Devel '

> 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.

That was the original motivation indeed.

> 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.

Sounds good to me,


        Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: echo area feedback for minor modes [define-minor-mode patch]
  2006-04-22 15:58 echo area feedback for minor modes [define-minor-mode patch] David Reitter
  2006-04-23 14:14 ` Stefan Monnier
@ 2006-04-23 21:58 ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2006-04-23 21:58 UTC (permalink / raw)
  Cc: emacs-devel

This is a good change.  Please install it.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-04-23 21:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-22 15:58 echo area feedback for minor modes [define-minor-mode patch] David Reitter
2006-04-23 14:14 ` Stefan Monnier
2006-04-23 21:58 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).