emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#19690: closed ([PATCH] Clarify mode switch message


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#19690: closed ([PATCH] Clarify mode switch messages to avoid potential confusion)
Date: Wed, 18 Feb 2015 01:07:01 +0000

Your message dated Wed, 18 Feb 2015 01:05:03 +0000
with message-id <address@hidden>
and subject line Re: Clarify mode switch messages to avoid potential confusion
has caused the debbugs.gnu.org bug report #19690,
regarding [PATCH] Clarify mode switch messages to avoid potential confusion
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
19690: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19690
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH] Clarify mode switch messages to avoid potential confusion Date: Mon, 26 Jan 2015 03:40:58 +0000
This is only a feature enhancement, not a bug report.

When first learning Emacs, I was often confused about whether a minor mode was 
enabled globally or just in the current buffer. For example, show-paren-mode is 
global, but whitespace-mode is buffer-local (unless you use 
global-whitespace-mode). I still sometimes misinterpret this.

Sure, the user can find out, but the attached patch helps make things clear, by 
indicating if the mode being toggled is buffer-local. It will be especially 
helpful for alerting users in the relatively rare cases when they toggle a 
normally-global minor mode that has been set buffer-locally.

BTW, in define-minor-mode, last-message is indirected, but I don't see any 
reason not to just use it directly.

--- emacs-24.4/lisp/emacs-lisp/easy-mmode.el
+++ emacs-24.4/lisp/emacs-lisp/easy-mmode.el
@@ -279,14 +279,23 @@
            (if (called-interactively-p 'any)
                (progn
                  ,(if (and globalp (symbolp mode))
+                     ;; Unnecessary but harmless if mode set buffer-locally
                       `(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")))))
+                   (let ((local
+                         ,(if globalp
+                              (if (symbolp mode)
+                                  `(if (assq ',mode (buffer-local-variables))
+                                       " in current buffer"
+                                     "")
+                                "")
+                            " in current buffer")))
+                    (message ,(format "%s %%sabled%%s" pretty-name)
+                             (if ,mode "en" "dis") local)))))
           ,@(when after-hook `(,after-hook)))
         (force-mode-line-update)
         ;; Return the new setting.

--- End Message ---
--- Begin Message --- Subject: Re: Clarify mode switch messages to avoid potential confusion Date: Wed, 18 Feb 2015 01:05:03 +0000
Applied to trunk.


--- End Message ---

reply via email to

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