unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Titus von der Malsburg <malsburg@posteo.de>
To: Joost Kremers <joostkremers@fastmail.fm>
Cc: emacs-devel@gnu.org
Subject: Re: Policy for declaring safe local variable values
Date: Fri, 08 Oct 2021 14:51:35 +0000	[thread overview]
Message-ID: <87a6jj7elj.fsf@posteo.de> (raw)
In-Reply-To: <877denu95f.fsf@fastmail.fm>


On 2021-10-08 Fri 11:55, Joost Kremers <joostkremers@fastmail.fm> wrote:
> On Fri, Oct 08 2021, Titus von der Malsburg wrote:
>> I have a configuration variable (in package bibtex-completion) that can usefully be set to a local value via a ‘Local Variable‘ comment in the file.  E.g:
>>
>> # Local Variables:
>> # bibtex-completion-bibliography: "/path/to/bibliography.bib"
>> # End:
>>
>> However, it’s annoying that users have to confirm that the local value for this
>> variable is safe every time they open a file with a different value for that
>> variable.
>
> Fun fact: answering your e-mail in Emacs I got the same question. :-)

This is scary and perhaps even a bug?  It seems wrong that text in e-mails should be allowed to set local variables.

>> Question: Can I declare the variable safe for local values in my
>> package, e.g.
>>
>> (put 'bibtex-completion-bibliography 'safe-local-variable (lambda (_) t))
>>
>> or would that violate Emacs conventions?
>
> `defcustom` even has a keyword for it (`:safe`), so I don't think it violates
> any conventions.
>
> TBH, I use this method in some of my packages and it never occurred to me it
> might be against conventions...

Thank you.  I wasn’t aware of the ‘:safe‘ keyword.

  Titus




  reply	other threads:[~2021-10-08 14:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08  9:11 Policy for declaring safe local variable values Titus von der Malsburg
2021-10-08  9:55 ` Joost Kremers
2021-10-08 14:51   ` Titus von der Malsburg [this message]
2021-10-08 15:06     ` Joost Kremers
2021-10-08 10:09 ` Lars Ingebrigtsen

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=87a6jj7elj.fsf@posteo.de \
    --to=malsburg@posteo.de \
    --cc=emacs-devel@gnu.org \
    --cc=joostkremers@fastmail.fm \
    /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).