From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: how to reference the current *.el file in elisp Date: Mon, 29 Jun 2009 23:30:49 -0400 Organization: A noiseless patient Spider Message-ID: References: <87eit2zeyg.fsf@jidanni.org> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1246339467 26578 80.91.229.12 (30 Jun 2009 05:24:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 30 Jun 2009 05:24:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 30 07:24:20 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MLVpL-0003rr-Cy for geh-help-gnu-emacs@m.gmane.org; Tue, 30 Jun 2009 07:24:19 +0200 Original-Received: from localhost ([127.0.0.1]:42535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLVpK-0007R2-IS for geh-help-gnu-emacs@m.gmane.org; Tue, 30 Jun 2009 01:24:18 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!tudelft.nl!txtfeed1.tudelft.nl!newsfeed.straub-nv.de!feeder.erje.net!188.40.43.213.MISMATCH!feeder.eternal-september.org!eternal-september.org!news.eternal-september.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-X-Trace: news.eternal-september.org U2FsdGVkX1+vBks5oo/dj2s3v+BWdooKA4eTWVR2G3dac/PcK+0JuchAG1S0BVdRc0q8svuXXrGNwwog4/UJdnY9lbwx1/xNInkEP83D4UqEFDn8IyueHlfl8BNUE5dZn+O6ECV/7ek= Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Tue, 30 Jun 2009 03:33:46 +0000 (UTC) X-Auth-Sender: U2FsdGVkX19Pr9/3F/I0kKcbeIJls0qgP8IgWPn9s8g= Cancel-Lock: sha1:6nEBKEQzLyfFpYrvLYZh1+ypM2A= User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Mail-Copies-To: nobody Original-Xref: news.stanford.edu gnu.emacs.help:170445 X-Mailman-Approved-At: Tue, 30 Jun 2009 00:57:11 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:65665 Archived-At: In article <87eit2zeyg.fsf@jidanni.org>, jidanni@jidanni.org wrote: > > How do I do things like > > # Local Variables: > > # compile-command: (concat "blarfowitz --nizbotize" buffer-file-name) > > # End: > > without being asked about risky variables, or hard wiring buffer-file-name? > > BM> if you want to customize risky local variables, see the > BM> safe-local-variables-p function. > > OK, I read that, and (info "(emacs) Safe File Variables") > but I still don't get why buffer-file-name is so unsafe... OK, maybe one The warning isn't about buffer-file-name, it's about compile-command. It warns if you try to set it to something other than a string. In your case, you're trying to set it to a list. > can set it to /etc/passwd and cause one to zap that file... Anyway, in > perl or sh there is the handy > $PROGRAM_NAME > $0 Contains the name of the program being executed. > So why in "Local Variables" stanzas is there no way to refer to the > current file being edited, without setting off all kinds of fire alarms, > or being forced to whitelist something because it is dangerous, thus > exposing myself to danger elsewhere. See also > http://groups.google.com/groups/search?as_umsgid=mailman.597.1244940108.2239.h > elp-gnu-emacs@gnu.org Values in the local variables stanza aren't evaluated, they're treated as literals. So there's no referring possible. This is why hooks are usually more appropriate for complex things like this. If you really do need a special compile-command just for one specific file, you'll have to hard-code the file's name into it, e.g. # compile-command: blarfowitz --nizbotize myscript.sh -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***