unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: 44629@debbugs.gnu.org
Subject: bug#44629: 28.0.50; Eglot noisy with gfm-view-mode and view-read-only
Date: Sun, 15 Nov 2020 09:55:39 +0000	[thread overview]
Message-ID: <87blfzkkpw.fsf@gmail.com> (raw)
In-Reply-To: <871rgvj1ym.fsf@tcd.ie> (Basil L. Contovounesios's message of "Sat, 14 Nov 2020 17:13:53 +0000")

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> João Távora <joaotavora@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





      reply	other threads:[~2020-11-15  9:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-14 10:58 bug#44629: 28.0.50; Eglot noisy with gfm-view-mode and view-read-only Basil L. Contovounesios
2020-11-14 11:15 ` Basil L. Contovounesios
2020-11-14 12:02   ` Eli Zaretskii
2020-11-14 12:26     ` Basil L. Contovounesios
2020-11-14 14:46       ` Eli Zaretskii
2020-11-14 15:13         ` João Távora
2020-11-15 20:27     ` Juri Linkov
2020-11-15 21:52       ` Basil L. Contovounesios
2020-11-15 23:14         ` João Távora
2020-11-17 20:15           ` Basil L. Contovounesios
2020-11-17 20:21             ` Basil L. Contovounesios
2020-11-17 22:55             ` João Távora
2020-11-28 21:27               ` Basil L. Contovounesios
2020-11-29 10:36             ` Lars Ingebrigtsen
2020-12-03 15:26               ` Basil L. Contovounesios
2020-11-16  9:14         ` Juri Linkov
2020-11-14 13:47 ` João Távora
2020-11-14 17:13   ` Basil L. Contovounesios
2020-11-15  9:55     ` João Távora [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blfzkkpw.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=44629@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).