unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Unsafe local variable in eglot.el
Date: Thu, 9 Mar 2023 09:31:36 +0000	[thread overview]
Message-ID: <CALDnm53gZH5igi6M0mBqt9o7go16STaf2=ynoCDBYQXBS7RrVA@mail.gmail.com> (raw)
In-Reply-To: <83mt4m2w23.fsf@gnu.org>

On Thu, Mar 9, 2023 at 8:00 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> João,
>
> This recent change:
>
>   commit 0a4b1c0102d4062d24e19340f863b9df25e07ab3
>   Author:     Joao Távora <joaotavora@gmail.com>
>   AuthorDate: Wed Mar 1 13:24:07 2023 +0000
>   Commit:     Joao Távora <joaotavora@gmail.com>
>   CommitDate: Wed Mar 1 13:27:06 2023 +0000
>
>       ; Eglot: improve bug-reference-url-format/bug-reference-url-regexp
>
>       * lisp/progmodes/eglot.el (eglot--debbugs-or-github-bug-uri): New helper.
>
> causes trouble when visiting eglot.el.

I've reproduced it with

  cd path/to/Emacs
  src/emacs -Q lisp/progmodes/eglot.el

But curiously, this doesn't reproduce it

  src/emacs -Q
  C-h f eglot RET
  C-x o TAB RET  ;; to visit the "eglot.el" link

Why is that?

Anyway, I just followed the docstring:

  bug-reference-url-format is a variable defined in `bug-reference.el'.

  Its value is `eglot--debbugs-or-github-bug-uri'
  Local in buffer eglot.el; global value is nil

  Format used to turn a bug number into a URL.
  The bug number is supplied as a string, so this should have a single %s.
  This can also be a function designator; it is called without arguments
   and should return a string.
  It can use `match-string' to get parts matched against
  `bug-reference-bug-regexp', specifically:
   1. issue kind (bug, patch, rfe &c)
   2. issue number.

  There is no default setting for this, it must be set per file.
  If you set it to a symbol in the file Local Variables section,
  you need to add a `bug-reference-url-format' property to it:
  (put 'my-bug-reference-url-format 'bug-reference-url-format t)
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  so that it is considered safe, see `enable-local-variables'.

> First, this pops up the "variable may not be safe" buffer about the
> variable bug-reference-url-format, even if I use Emacs 29, let alone
> if I use older Emacs versions.
>
> And second, if I say "y" to the "apply unsafe variable" prompt, then
> with the following jit-lock settings:
>
>   (setq jit-lock-stealth-time 16)
>   (setq jit-lock-stealth-nice 0.5)
>   (setq jit-lock-stealth-verbose t)
>   (setq jit-lock-defer-contextually t)
>   (setq jit-lock-stealth-load 20)
>
> I get an error from jit-lock-stealth's timer:
>
>   Error running timer ‘jit-lock-stealth-fontify’: (void-function eglot--debbugs-or-github-bug-uri)
>
> The only way of avoiding these two issues is to say "n" to the prompt
> asking whether to apply the variable, but that's not really a good
> workaround, is it?
>
> Can these problems be solved, please, preferably in a way that older
> Emacsen will also be happy (since Eglot is an ELPA package)?

Maybe the function can be autoloaded?

But is a significant number of people using older emacsen to edit
Emacs's lisp/progmodes/eglot.el?  As far as I've seen just now,
if you launch an older Emacs to edit Emacs code, you warnings
about unsafe local variables in Emacs's own top-evel .dir-locals.el.

Until a solution is found, feel free to revert this change,
because this is just a minor convenience, and mostly just
for me (though it _is_ quite convenient).

João



  reply	other threads:[~2023-03-09  9:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09  8:00 Unsafe local variable in eglot.el Eli Zaretskii
2023-03-09  9:31 ` João Távora [this message]
2023-03-09 11:24   ` João Távora
2023-03-09 12:19     ` Eli Zaretskii
2023-03-09 13:07       ` João Távora
2023-03-09 15:54         ` Eli Zaretskii
2023-03-09 11:56   ` Eli Zaretskii
2023-03-09 12:10     ` Tassilo Horn
2023-03-09 13:12       ` João Távora
2023-03-10  7:44         ` Tassilo Horn
2023-03-09 12:19     ` João Távora

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='CALDnm53gZH5igi6M0mBqt9o7go16STaf2=ynoCDBYQXBS7RrVA@mail.gmail.com' \
    --to=joaotavora@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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).