From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Reitter Newsgroups: gmane.emacs.devel Subject: echo area feedback for minor modes [define-minor-mode patch] Date: Sat, 22 Apr 2006 16:58:18 +0100 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1145721511 13413 80.91.229.2 (22 Apr 2006 15:58:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 22 Apr 2006 15:58:31 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 22 17:58:30 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FXKVA-000542-K8 for ged-emacs-devel@m.gmane.org; Sat, 22 Apr 2006 17:58:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FXKVA-0005tA-8B for ged-emacs-devel@m.gmane.org; Sat, 22 Apr 2006 11:58:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FXKUy-0005st-Vn for emacs-devel@gnu.org; Sat, 22 Apr 2006 11:58:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FXKUv-0005qw-0z for emacs-devel@gnu.org; Sat, 22 Apr 2006 11:58:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FXKUu-0005qm-Kl for emacs-devel@gnu.org; Sat, 22 Apr 2006 11:58:12 -0400 Original-Received: from [212.227.126.187] (helo=moutng.kundenserver.de) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FXKWi-0000gL-NR for emacs-devel@gnu.org; Sat, 22 Apr 2006 12:00:05 -0400 Original-Received: from [129.215.174.81] (helo=[129.215.174.81]) by mrelayeu.kundenserver.de (node=mrelayeu4) with ESMTP (Nemesis), id 0ML21M-1FXKUt1ZbB-0003pe; Sat, 22 Apr 2006 17:58:11 +0200 Original-To: Emacs-Devel ' X-Mailer: Apple Mail (2.749.3) X-Provags-ID: kundenserver.de abuse@kundenserver.de login:f3c9a04d49beab9fcce37ffcb55ebfb9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:53237 Archived-At: 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)