From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.help Subject: Re: Local variables list Date: Thu, 02 Oct 2014 22:33:08 +0200 Organization: Informatimago Message-ID: <8738b6p5yz.fsf@kuiper.lan.informatimago.com> References: <87lhoypsj1.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1412282423 7408 80.91.229.3 (2 Oct 2014 20:40:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Oct 2014 20:40:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 02 22:40:18 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XZnAg-0000Gr-LI for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Oct 2014 22:40:18 +0200 Original-Received: from localhost ([::1]:36410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZnAg-0003jF-AZ for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Oct 2014 16:40:18 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 121 Original-X-Trace: individual.net B+MWvekv2c7hPGMFKRojzAgitZhVCjVhkrEGKdaTfxO1RIsqrl Cancel-Lock: sha1:YmJlMzNlYTdmYTMyMWRmZjgwNjI2MTI3NzRmMzk4OWU0OGIxMzRlOQ== sha1:ur/Xv5DDSmy8wL8+nrue8GtuEnk= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:207962 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:100237 Archived-At: Dieter Britz writes: > On Thu, 02 Oct 2014 14:25:54 +0200, Pascal J. Bourguignon wrote: > >> Dieter Britz writes: >> >>> For some files, when I start emacs, I get a warning something like "The >>> local variables list for 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). > > Thanks - I don't fully understand but will watch out for this. > These must get into the file without my doing. I find in one of > these, at the end, the lines > > %%% Local Variables: > %%% mode: latex > %%% TeX-master: t > %%% End: > > How did they get there? Somebody wrote them in that file. > What are local variables? File Local Variables are buffer local variables that are set in the buffer where the file is loaded. See: (info "(emacs) File Variables") ; type C-x C-e before this comment. > I suppose they are connected with the settings my emacs has (?) - > these must be default because I have never set anything. No, there are the opposite of default settings. They are the most specific settings you can get with emacs, specifically for buffers visiting this specific file. emacs consider unsafe all the variables it doesn't know to be safe. TeX-master is unknown to be safe, so it's marked with one star. Since the value is a simple symbol (t), it looks rather safe to set this variable (and let whatever code you already loaded use it when processing your buffer). To be compared with post-command-hook, which is known to be unsafe, and which emacs marked with two stars. If you want to know what the variable is used for, you can type C-h v TeX-master RET and see if it's documented. Otherwise, you could check the source of any package that use the TeX- prefix for their stuff. Otherwise, it's possible no code uses it. -- __Pascal Bourguignon__ http://www.informatimago.com/ “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.” -- Carl Bass CEO Autodesk