GNU bug report logs -
#58506
Use ".dir-locals.eld" and ".dir-locals-2.eld" when they exist
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Philip Kaludercic <philipk <at> posteo.net> writes:
>
>> Another idea could be to take inspiration from Guile's "Sandboxed
>> Evaluation"[0] and provide a "safe subset" of Elisp that can be
>> evaluated (with some additional checks).
>>
>> E.g. the following would allow evaluating `add-to-list' if the list if
>> safe and the value is self-evaluating:
>
> Oh, that's a good idea. I wonder whether anybody's written an
> interpreter for a "safe" version of Emacs Lisp -- then people could put
> `if' statements etc also into these files.
There is unsafep, but that is too strict for what we want. E.g.
(unsafep '(setq tab-width 3)) ;; => (global-variable tab-width)
even though we would want this to work. I've attached an incomplete
sketch of how this could look like
[safe-eval.el (text/plain, attachment)]
[Message part 3 (text/plain, inline)]
> We already mark functions as being side-effect-free, so it seems like
> code like
>
> (if (cl-oddp (% (random) 2))
> (setq ...))
>
> would be "safe" together with the safep markup for assignments we
> already have. We could make a safe restricted language subset for use
> both here and in similar circumstances.
That is a good point, but I think more tagging should be done. Ideally
this would read as regular elisp (which is kind of ironic considering
that we are discussing an .eld file), so it would be nice if
mode-specific modifications could be done by just writing
--8<---------------cut here---------------start------------->8---
(when (derived-mode-p 'c-mode)
(setq tab-width 8))
--8<---------------cut here---------------end--------------->8---
or something like that.
>> No, what I had in mind was not to trigger warnings but either to
>> highlight unused variables or provide a command that would check it for
>> you.
>
> Oh, right. That's another good idea. 😀
One idea would be to use Flymake.
This bug report was last modified 2 years and 243 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.