Subject: bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 03 Jun 2021 10:06:16 +0200

Drew Adams <[email-masked]> writes:

> Without bothering with a complete patch, I think this is the only code
> change needed, in library `easy-mmode.el':
>
>   (let ((local ,(if globalp "" " in current buffer")))
>
> should be 
>
>   (let ((local ,(if globalp
>                     ""
>                   '(format " in buffer `%s'" (current-buffer)))))

Here's the patch, since Drew couldn't be bothered:

diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 0a6d4ec504..4308272e42 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -360,7 +360,10 @@ define-minor-mode
                     (unless (and (current-message)
                                  (not (equal ,last-message
                                              (current-message))))
-                      (let ((local ,(if globalp "" " in current buffer")))
+                      (let ((local ,(if globalp
+                                        ""
+                                      '(format " in buffer `%s'"
+                                               (current-buffer)))))
 			(message ,(format "%s %%sabled%%s" pretty-name)
 			         (if ,getter "en" "dis") local)))))
 	      ,@(when after-hook `(,after-hook)))

But after running with this for a few minutes, I'm not sure I like it.
`C-x C-q' then says "Read-Only mode enabled in buffer `foo'" which makes
me wonder, of course, "why?  what happened to foo?  oh, this is that
buffer".

I.e., it's distracting, not useful information.

So I'm leaning towards leaving it the was it was.  Any opinions?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no