unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: "João Távora" <joaotavora@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	emacs-devel@gnu.org, Sam Steingold <sds@gnu.org>
Subject: Re: Unsafe local variable in eglot.el
Date: Fri, 10 Mar 2023 08:44:43 +0100	[thread overview]
Message-ID: <87pm9hoxpp.fsf@gnu.org> (raw)
In-Reply-To: <87356ejcg8.fsf@gmail.com>

João Távora <joaotavora@gmail.com> writes:

>> Not sure what to do here.  Maybe adding an autoload-cookie to
>> eglot--debbugs-or-github-bug-uri does the trick?  Of course, then you
>> cannot find eglot.el without loading it at the same time...
>
> See my 01b65d442a commit to Emacs 29.  It's autoloading a "progn"
> block in eglot.el.  So visiting the file with bug-reference-mode does
> trigger a call to the helper function, which now exists.  But that
> call by itself won't cause eglot.el to to be loaded.  It's not very
> elegant, but it does solve the program effectively, I think (and the
> links work, of course).

Ah, and indeed that's the documented way according to (info "(elisp)
File Local Variables"):

--8<---------------cut here---------------start------------->8---
   When defining a user option using ‘defcustom’, you can set its
‘safe-local-variable’ property by adding the arguments ‘:safe FUNCTION’
to ‘defcustom’ (*note Variable Definitions::).  However, a safety
predicate defined using ‘:safe’ will only be known once the package that
contains the ‘defcustom’ is loaded, which is often too late.  As an
alternative, you can use the autoload cookie (*note Autoload::) to
assign the option its safety predicate, like this:

     ;;;###autoload (put 'VAR 'safe-local-variable 'PRED)

The safe value definitions specified with ‘autoload’ are copied into the
package’s autoloads file (‘loaddefs.el’ for most packages bundled with
Emacs), and are known to Emacs since the beginning of a session.
--8<---------------cut here---------------end--------------->8---

Great that it works now as intended.

Bye,
Tassilo



  reply	other threads:[~2023-03-10  7:44 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
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 [this message]
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=87pm9hoxpp.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=sds@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).