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: Joost Kremers
Subject: Re: Policy for declaring safe local variable values
Date: Fri, 08 Oct 2021 11:55:44 +0200
User-agent: mu4e 1.6.6; emacs 27.2.50

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. :-)

> 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...

-- 
Joost Kremers
Life has its moments



reply via email to

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