From: Dieter Britz <dieterhansbritz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Local variables list
Date: Thu, 2 Oct 2014 13:16:20 +0000 (UTC) [thread overview]
Message-ID: <m0jj74$9ks$1@dont-email.me> (raw)
In-Reply-To: 87lhoypsj1.fsf@kuiper.lan.informatimago.com
On Thu, 02 Oct 2014 14:25:54 +0200, Pascal J. Bourguignon wrote:
> Dieter Britz <dieterhansbritz@gmail.com> writes:
>
>> For some files, when I start emacs, I get a warning something like "The
>> local variables list for <file> contains values that may not be
>> safe..." (I was not able to copy/paste so am citing from memory). I
>> then answer "yes" and I get in, but what does this mean? What can I do
>> about it?
>
> The file local variables are defined either on one of the first two
> lines, between "-*-" and "-*-", or in the last 512 bytes, between
> "\nLocal Variable:\n" and "\nEnd:\n".
>
> Some local variables are "safe" and/or have "safe" values. For example:
>
> ;; -*- mode:lisp; coding:utf-8; -*-
>
> on the first line define two variables, mode and coding to be set to
> lisp and utf-8 which are all safe.
>
> Some other local variables or values are not safe. For example:
>
> Local Variable:
> post-command-hook: ((lambda () (do-some-virus-propagation)))
> End:
>
> wouldn't be safe, and neither would:
>
> Local Variable:
> post-command-hook: ((lambda () (shell "rm -rf /")))
> End:
>
> It is to protect you from such files, that emacs warns you when it
> detect something strange in file local variables. You should not answer
> yes blindly, you should check those variables, and convince yourself
> that they are safe, before answering yes.
>
> The "*Local Variables*" buffer gives you the list of local variables,
> indicating those that are unsafe:
>
>
> -----(*Local
> Variables*)------------------------------------------------
> The local variables list in test-file contains varibles that are
> risk (**).
>
> Do you want to apply it? You can type y -- to apply the local
> variable list.
> n -- to ignore the local variables list.
>
> mode : text
> ** post-command-hook : ((lambda nil (message "hi")))
>
------------------------------------------------------------------------
>
> Here you can see that post-command-hook looks safe (but it will erase
> the current post-command-hook, so you might still want to answer n (and
> then remove it from the file).
I just saw this:
mode: latex
* TeX-master: t
what does this mean? And in what way can these variables
be unsafe? What can happen? Sorry to belabour this.
--
Dieter Britz
prev parent reply other threads:[~2014-10-02 13:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-02 12:01 Local variables list Dieter Britz
2014-10-02 12:25 ` Pascal J. Bourguignon
2014-10-02 12:58 ` Dieter Britz
2014-10-02 20:33 ` Pascal J. Bourguignon
2014-10-02 13:16 ` Dieter Britz [this message]
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='m0jj74$9ks$1@dont-email.me' \
--to=dieterhansbritz@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.
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).