GNU bug report logs -
#19690
[PATCH] Clarify mode switch messages to avoid potential confusion
Previous Next
Reported by: Kelly Dean <kelly <at> prtime.org>
Date: Mon, 26 Jan 2015 03:44:02 UTC
Severity: minor
Tags: patch
Done: Kelly Dean <kelly <at> prtime.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19690 in the body.
You can then email your comments to 19690 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#19690
; Package
emacs
.
(Mon, 26 Jan 2015 03:44:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Kelly Dean <kelly <at> prtime.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 26 Jan 2015 03:44:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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.
[dmm-mode-switch-msgs.patch (text/x-diff, inline)]
--- 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.
Reply sent
to
Kelly Dean <kelly <at> prtime.org>
:
You have taken responsibility.
(Wed, 18 Feb 2015 01:07:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Kelly Dean <kelly <at> prtime.org>
:
bug acknowledged by developer.
(Wed, 18 Feb 2015 01:07:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 19690-done <at> debbugs.gnu.org (full text, mbox):
Applied to trunk.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 18 Mar 2015 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 97 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.