emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Policy for declaring safe local variable values


From: Titus von der Malsburg
Subject: Re: Policy for declaring safe local variable values
Date: Fri, 08 Oct 2021 14:51:35 +0000

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 via email to

[Prev in Thread] Current Thread [Next in Thread]