help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: ;; Local variables: (was: Re: The function ‘cl-set-difference’ might


From: tomas
Subject: Re: ;; Local variables: (was: Re: The function ‘cl-set-difference’ might not be defined at runtime)
Date: Wed, 15 Apr 2020 19:25:54 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Apr 15, 2020 at 07:14:03PM +0200, Emanuel Berg via Users list for the 
GNU Emacs text editor wrote:
> tomas wrote:
> 
> >> [...] what does this mean?
> >> 
> >> ;; Local variables:
> >> ;; byte-compile-dynamic: t
> >> ;; End:
> >
> > Quoth "describe-variable" (aka C-h v):

[...]

> Yes, but I meant the comment/variable syntax, which
> I haven't see before. In the particular variable's
> docstring, they mention
> 
>   -*- byte-compile-dynamic: t -*-
> 
> so how does that differ from
> 
>   ;; Local variables:
>   ;; byte-compile-dynamic: t
>   ;; End:

The one goes to the beginning of the file, the other to the
end. Otherwise, they are just alternative ways to express
the same thing. The "-*- ... -*-" form has limitations whenever
the first line of the file is needed for other things (e.g.
the #! in shell scripts. When you've got many file variables,
the end form is arguably  a bit more readable. See "File
Variables" in the manual [1]

> As for the syntax, I tried with this and then did
> `emacs-lisp-mode', what happened was it popped up
> a warning telling me the values were possibly unsafe -
> what does that mean?
> 
>   ;; Local variables:
>   ;; local-test-var: t
>   ;; End:

File variables can do Bad Things (remember Word macro
viruses?). Code is potentially executed when you load
the file. So there's a limited set of file variables
considered "safe" (to which you can add) -- beyond
that you are warned (unless you switch that off).
Just imagine I (evil mastermind) send you a text
file with some bad stuff hidden in file variables...
See [2].

Cheers

[1] 
https://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html#Specifying-File-Variables
[2] 
https://www.gnu.org/software/emacs/manual/html_node/emacs/Safe-File-Variables.html#Safe-File-Variables
-- t

Attachment: signature.asc
Description: Digital signature


reply via email to

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