all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled
@ 2021-06-02 19:36 Drew Adams
  2021-06-02 20:59 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Drew Adams @ 2021-06-02 19:36 UTC (permalink / raw)
  To: 48798

A user can easily think s?he's in one window when another is actually
selected.  Or s?he can think that the buffer in the selected window is a
different one from what it actually is.

The confirmation/status message you get when you toggle a (local) minor
mode just tells you that the mode is enabled or disabled "in the current
buffer".  It should provide more help than that, naming the buffer.
That confirms what you expected or lets you know that you were wrong
about your expectation.

For example, when you use `C-x C-q', it's better to see "Read-Only mode
enabled in buffer `foobar'" than it is to see "Read-Only mode enabled in
current buffer".  Just that bit of information and reassurance can help.

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)))))

In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
 of 2019-08-29
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor `Microsoft Corp.', version 10.0.19041
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled
  2021-06-02 19:36 bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled Drew Adams
@ 2021-06-02 20:59 ` Drew Adams
  2021-06-03  8:06 ` Lars Ingebrigtsen
  2021-10-16 21:57 ` Drew Adams
  2 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2021-06-02 20:59 UTC (permalink / raw)
  To: Drew Adams, 48798@debbugs.gnu.org

In case the argument wasn't sufficiently
persuasive, please consider this:

When you load a Lisp file, including when you
just load the file that's visited in the current
buffer (i.e., `M-x load-file RET'), Emacs always
tells you which file was loaded:

 Loading /some/directory/foobar.el (source)...done

Now imagine that Emacs wasn't so helpful, but
just echoed this each time:

  Loading current file...done

or

  Loading file visited in current buffer...done

Emacs can do better for minor-mode toggling also.






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled
  2021-06-02 19:36 bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled Drew Adams
  2021-06-02 20:59 ` Drew Adams
@ 2021-06-03  8:06 ` Lars Ingebrigtsen
  2021-07-01 11:45   ` Lars Ingebrigtsen
  2021-10-16 21:57 ` Drew Adams
  2 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-03  8:06 UTC (permalink / raw)
  To: Drew Adams; +Cc: 48798

Drew Adams <drew.adams@oracle.com> 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





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled
  2021-06-03  8:06 ` Lars Ingebrigtsen
@ 2021-07-01 11:45   ` Lars Ingebrigtsen
  2021-07-01 14:16     ` bug#48798: [External] : " Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-01 11:45 UTC (permalink / raw)
  To: Drew Adams; +Cc: 48798

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I.e., it's distracting, not useful information.
>
> So I'm leaning towards leaving it the was it was.  Any opinions?

Nobody had any in a month, so I'm closing this bug report.

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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#48798: [External] : Re: bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled
  2021-07-01 11:45   ` Lars Ingebrigtsen
@ 2021-07-01 14:16     ` Drew Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2021-07-01 14:16 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 48798@debbugs.gnu.org

> > I.e., it's distracting, not useful information.
> >
> > So I'm leaning towards leaving it the was it was.  Any opinions?
> 
> Nobody had any in a month, so I'm closing this bug report.

Too bad.  All you had to do was _add_ the buffer name,
_along with_ "current buffer" which was already there.

With your logic, the message when loading the file of
the current buffer should also _not_ report the file
name.  E.g. `M-x load-file RET' should not tell you
which file was load because (according to you), that
info is just noise and it's obvious which buffer was
current and thus which file was loaded.  Fortunately,
whoever wrote the load-file msg didn't use such logic.

Dommage.









^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled
  2021-06-02 19:36 bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled Drew Adams
  2021-06-02 20:59 ` Drew Adams
  2021-06-03  8:06 ` Lars Ingebrigtsen
@ 2021-10-16 21:57 ` Drew Adams
  2023-01-28 21:55   ` Drew Adams
  2 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2021-10-16 21:57 UTC (permalink / raw)
  To: Drew Adams, Lars Ingebrigtsen
  Cc: 33076@debbugs.gnu.org, 48798@debbugs.gnu.org

The same problem persists - bugs #33076 and #48798.

It's quite possible to not notice - or even not be
able to easily see - which buffer is current when
it's changed to/from read-only.  It  just makes
sense to tell users which buffer is involved.

Really hard to believe this isn't obvious and the 
trivial fix wasn't applied.  This just makes life
that much harder for users, with no benefit to Emacs.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled
  2021-10-16 21:57 ` Drew Adams
@ 2023-01-28 21:55   ` Drew Adams
  2023-07-04 15:08     ` bug#33076: " Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2023-01-28 21:55 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 33076@debbugs.gnu.org, 48798@debbugs.gnu.org

> The same problem persists - bugs #33076 and #48798.
> 
> It's quite possible to not notice - or even not be
> able to easily see - which buffer is current when
> it's changed to/from read-only.  It  just makes
> sense to tell users which buffer is involved.
> 
> Really hard to believe this isn't obvious and the
> trivial fix wasn't applied.  This just makes life
> that much harder for users, with no benefit to Emacs.

Perhaps the problem is more noticeable if buffers
are in separate frames.  Especially since Emacs
has messed with frame focus so much (since Emacs
26, at least).  If the buffer you thought was
current with its window selected is not, for some
reason (e.g. gratuitous Emacs frame-focus switch),
then the message doesn't help at all if you have
multiple buffers in separate frames etc.

I'm guessing that this might be why Lars didn't
think this was a real problem.  It might be less
noticeable if you're not a victim of Emacs's
gratuitous frame focus-switching.

But even if that's not the case, I see no reason
why this shouldn't be fixed.  _Whatever_ the
reason might be why someone doesn't know or isn't
sure which buffer had the focus, why not have a
message that tells you what Emacs actually did?

Please reopen this bug and apply the trivial fix.
Thx.  I'd really not like to have to redefine
`define-minor-mode' for my own use, just to fix
this annoyance.  To me, this message improvement
for users should be a no-brainer.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#33076: bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled
  2023-01-28 21:55   ` Drew Adams
@ 2023-07-04 15:08     ` Drew Adams
  2023-07-04 15:25       ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2023-07-04 15:08 UTC (permalink / raw)
  To: Drew Adams; +Cc: 33076@debbugs.gnu.org, 48798@debbugs.gnu.org

> > The same problem persists - bugs #33076 and #48798.
> >
> > It's quite possible to not notice - or even not be
> > able to easily see - which buffer is current when
> > it's changed to/from read-only.  It  just makes
> > sense to tell users which buffer is involved.
> >
> > Really hard to believe this isn't obvious and the
> > trivial fix wasn't applied.  This just makes life
> > that much harder for users, with no benefit to Emacs.
> 
> Perhaps the problem is more noticeable if buffers
> are in separate frames.  Especially since Emacs
> has messed with frame focus so much (since Emacs
> 26, at least).  If the buffer you thought was
> current with its window selected is not, for some
> reason (e.g. gratuitous Emacs frame-focus switch),
> then the message doesn't help at all if you have
> multiple buffers in separate frames etc.
> 
> I'm guessing that this might be why Lars didn't
> think this was a real problem.  It might be less
> noticeable if you're not a victim of Emacs's
> gratuitous frame focus-switching.
> 
> But even if that's not the case, I see no reason
> why this shouldn't be fixed.  _Whatever_ the
> reason might be why someone doesn't know or isn't
> sure which buffer had the focus, why not have a
> message that tells you what Emacs actually did?
> 
> Please reopen this bug and apply the trivial fix.
> Thx.  I'd really not like to have to redefine
> `define-minor-mode' for my own use, just to fix
> this annoyance.  To me, this message improvement
> for users should be a no-brainer.

I'm asking again that this be fixed.  I'm not
asking that such a message be changed for all
modes, i.e., a change in `define-minor-mode'.

Whether that would be appropriate is TBD - a
different question.  It could be asked, but
I'm not asking it here.
 
For this enhancement request I'm asking only
that this be fixed for `read-only-mode'.  In
various situations it can be nonobvious which
buffer's read-only state was changed.

And there's really no good reason why the
buffer name shouldn't be included in the msg.
And no objective reason was given - the only
reason given was that Lars subjectively found
the fix to be "more annoying than informative".

Whether or not the code below is the right
fix is for you to decide.  It gets the job
done and shows what the behavior should be.
I don't care how the fix gets implemented.

(defun ro-echo-buffer ()
  "Echo `buffer-read-only' value, showing buffer name."
  (message "Read-only mode is %s in buffer `%s'"
           (if buffer-read-only 'ON 'OFF)
           (current-buffer)))

(add-hook 'read-only-mode-hook 'ro-echo-buffer)

Please reconsider Emacs not letting users see
this little bit of important info in the msg.

___

As for whether ON/OFF is kosher, vs the more
verbose and less noticeable enabled/disabled:

I think it should be.  In fact, I think it's
preferable, at least in a message.  And Emacs
itself sometimes says that a mode is "active"
instead of "enabled".  (e.g. allout.el,
autorevert.el)  I think uppercase ON and OFF
stand out clearly in such a message, and that
helps.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled
  2023-07-04 15:08     ` bug#33076: " Drew Adams
@ 2023-07-04 15:25       ` Drew Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2023-07-04 15:25 UTC (permalink / raw)
  To: 48798@debbugs.gnu.org

Guess I have to send this again, after unarchiving this bug (as well as 33076)?  Is it the case that if N bugs were merged then it's not enough to unarchive one of them - you need to unarchive all of them?

> > The same problem persists - bugs #33076 and #48798.
> >
> > It's quite possible to not notice - or even not be
> > able to easily see - which buffer is current when
> > it's changed to/from read-only.  It  just makes
> > sense to tell users which buffer is involved.
> >
> > Really hard to believe this isn't obvious and the
> > trivial fix wasn't applied.  This just makes life
> > that much harder for users, with no benefit to Emacs.
> 
> Perhaps the problem is more noticeable if buffers
> are in separate frames.  Especially since Emacs
> has messed with frame focus so much (since Emacs
> 26, at least).  If the buffer you thought was
> current with its window selected is not, for some
> reason (e.g. gratuitous Emacs frame-focus switch),
> then the message doesn't help at all if you have
> multiple buffers in separate frames etc.
> 
> I'm guessing that this might be why Lars didn't
> think this was a real problem.  It might be less
> noticeable if you're not a victim of Emacs's
> gratuitous frame focus-switching.
> 
> But even if that's not the case, I see no reason
> why this shouldn't be fixed.  _Whatever_ the
> reason might be why someone doesn't know or isn't
> sure which buffer had the focus, why not have a
> message that tells you what Emacs actually did?
> 
> Please reopen this bug and apply the trivial fix.
> Thx.  I'd really not like to have to redefine
> `define-minor-mode' for my own use, just to fix
> this annoyance.  To me, this message improvement
> for users should be a no-brainer.

I'm asking again that this be fixed.  I'm not
asking that such a message be changed for all
modes, i.e., a change in `define-minor-mode'.

Whether that would be appropriate is TBD - a
different question.  It could be asked, but
I'm not asking it here.
 
For this enhancement request I'm asking only
that this be fixed for `read-only-mode'.  In
various situations it can be nonobvious which
buffer's read-only state was changed.

And there's really no good reason why the
buffer name shouldn't be included in the msg.
And no objective reason was given - the only
reason given was that Lars subjectively found
the fix to be "more annoying than informative".

Whether or not the code below is the right
fix is for you to decide.  It gets the job
done and shows what the behavior should be.
I don't care how the fix gets implemented.

(defun ro-echo-buffer ()
  "Echo `buffer-read-only' value, showing buffer name."
  (message "Read-only mode is %s in buffer `%s'"
           (if buffer-read-only 'ON 'OFF)
           (current-buffer)))

(add-hook 'read-only-mode-hook 'ro-echo-buffer)

Please reconsider Emacs not letting users see
this little bit of important info in the msg.

___

As for whether ON/OFF is kosher, vs the more
verbose and less noticeable enabled/disabled:

I think it should be.  In fact, I think it's
preferable, at least in a message.  And Emacs
itself sometimes says that a mode is "active"
instead of "enabled".  (e.g. allout.el,
autorevert.el)  I think uppercase ON and OFF
stand out clearly in such a message, and that
helps.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-07-04 15:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-02 19:36 bug#48798: 26.3; `define-minor-mode': Message should name the current buffer where enabled/disabled Drew Adams
2021-06-02 20:59 ` Drew Adams
2021-06-03  8:06 ` Lars Ingebrigtsen
2021-07-01 11:45   ` Lars Ingebrigtsen
2021-07-01 14:16     ` bug#48798: [External] : " Drew Adams
2021-10-16 21:57 ` Drew Adams
2023-01-28 21:55   ` Drew Adams
2023-07-04 15:08     ` bug#33076: " Drew Adams
2023-07-04 15:25       ` Drew Adams

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.