GNU bug report logs - #44629
28.0.50; Eglot noisy with gfm-view-mode and view-read-only

Previous Next

Package: emacs;

Reported by: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Date: Sat, 14 Nov 2020 10:59:02 UTC

Severity: minor

Tags: fixed, patch

Found in version 28.0.50

Fixed in version 28.1

Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 44629 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 44629 <at> debbugs.gnu.org
Subject: Re: bug#44629: 28.0.50; Eglot noisy with gfm-view-mode and
 view-read-only
Date: Sun, 15 Nov 2020 09:55:39 +0000
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> João Távora <joaotavora <at> gmail.com> writes:
>
> [...]
>
>> I'd say the fix here is for Eglot, jsonrpc.el and all all other code
>> that needs to set a buffer read only for implementation purposes just
>> sets the variable buffer-read-only.  In fact, the docstring of
>> read-only-mode hints at this:
>
> [...]
>
>> Alternatively, and very cautiously, we could also say that the echo area
>> message issued by view-mode should only be displayed to the user if it's
>> running interactively, i.e. if it's a direct synchronous consequence of
>> an interactive command.  That would exclude elisp code running
>> asynchronously like jsonrpc.el's updating of the events buffer, and
>> probably also the use that ElDoc clients make of `read-only-mode`.
>
> [...]
>
>> In that spirit, maybe this could fix it?
>>
>>     diff --git a/lisp/view.el b/lisp/view.el
>>     index 204e28c2a2..6233f3ba7d 100644
>>     --- a/lisp/view.el
>>     +++ b/lisp/view.el
>>     @@ -559,7 +559,8 @@ view-mode-enter
>>      
>>        (unless view-mode
>>          (view-mode 1)
>>     -    (unless view-inhibit-help-message
>>     +    (unless (or view-inhibit-help-message
>>     +                (not (called-interactively-p 'interactive)))
>>            (message "%s"
>>      	       (substitute-command-keys "\
>>      View mode: type \\[help-command] for help, \\[describe-mode] for commands, \\[View-quit] to quit.")))))
>
> I don't think so, at least not in that exact manifestation, because
> view-mode-enter is seldom, if ever, called interactively.  I.e. this
> will suppress the help message even when you visit a read-only file.

You're of course right.  This is for the immediately "containing
function", not for the "current stack".  But 'this-command' could do
the trick;

     diff --git a/lisp/view.el b/lisp/view.el
     index 204e28c2a2..2a0fc85cb8 100644
     --- a/lisp/view.el
     +++ b/lisp/view.el
     @@ -559,7 +559,8 @@ view-mode-enter
      
        (unless view-mode
          (view-mode 1)
     -    (unless view-inhibit-help-message
     +    (unless (or view-inhibit-help-message
     +                (not this-command))
            (message "%s"
                    (substitute-command-keys "\
      View mode: type \\[help-command] for help, \\[describe-mode] for commands, \\[View-quit] to quit.")))))

When I have this, and view-read-only set to t, C-x C-f'ing to /etc/fstab
gets me the message but this:

    (run-with-timer 1 nil (lambda () (find-file "/etc/fstab")))

does not.

Anyway, feel free to beat me to the patches to jsonrpc.el and Eglot (the
former you can do directly on the tree, the latter can be done via
GitHub, or just send me the patch here).

João




This bug report was last modified 4 years and 228 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.