From: Kelly Dean <kelly@prtime.org>
To: 19690@debbugs.gnu.org
Subject: bug#19690: [PATCH] Clarify mode switch messages to avoid potential confusion
Date: Mon, 26 Jan 2015 03:40:58 +0000 [thread overview]
Message-ID: <WytLYirwYteGOP8sjoOmAIL4bAIvS63icAG1Qs9gpLZ@local> (raw)
[-- Attachment #1: Type: text/plain, Size: 742 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dmm-mode-switch-msgs.patch --]
[-- Type: text/x-diff, Size: 1185 bytes --]
--- 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.
next reply other threads:[~2015-01-26 3:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-26 3:40 Kelly Dean [this message]
2015-02-18 1:05 ` bug#19690: Clarify mode switch messages to avoid potential confusion Kelly Dean
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=WytLYirwYteGOP8sjoOmAIL4bAIvS63icAG1Qs9gpLZ@local \
--to=kelly@prtime.org \
--cc=19690@debbugs.gnu.org \
/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.