GNU bug report logs - #6615
document how to specify the current filename in Local Variables

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Mon, 12 Jul 2010 04:21:02 UTC

Severity: wishlist

Merged with 29451, 34130, 35373

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6615 in the body.
You can then email your comments to 6615 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6615; Package emacs. (Mon, 12 Jul 2010 04:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 12 Jul 2010 04:21:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: jidanni <at> jidanni.org
To: bug-gnu-emacs <at> gnu.org
Subject: document how to specify the current filename in Local Variables
Date: Mon, 12 Jul 2010 12:19:47 +0800
(info "(emacs) Specifying File Variables")
(info "(emacs) Safe File Variables")
Should say how to do
http://permalink.gmane.org/gmane.emacs.bugs/8844
correctly, and why there IS NO WAY to specify the current filename,
without a big hassle, even though there is just as much risk as if one
hardwired it into the file.




Merged 6615 29451. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 26 Nov 2017 18:00:02 GMT) Full text and rfc822 format available.

Merged 6615 29451 34130. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 19 Jan 2019 11:23:02 GMT) Full text and rfc822 format available.

Merged 6615 29451 34130 35373. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 22 Apr 2019 02:09:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6615; Package emacs. (Tue, 01 Oct 2019 19:29:02 GMT) Full text and rfc822 format available.

Message #14 received at 6615 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 34130 <at> debbugs.gnu.org, 6615 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#34130: Specifying File Variables: mention why can't specify
 "current file"
Date: Tue, 01 Oct 2019 21:28:06 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> On (info "(emacs) Specifying File Variables")
>> at
>> 
>>      # Local Variables:
>>      # compile-command: "cc foo.c -Dfoo=bar -Dhack=whatever \
>>      #   -Dmumble=blaah"
>>      # End:
>> 
>> do also mention why there is absolutely no way to say "<<<current file>>>",
>> $$$${current_file} etc. if one wanted to, instead of needing to hardwire
>> the filename (foo.c) of the file (foo.c) into the file (foo.c) itself! Thanks.
>
> Is something wrong with using buffer-file-name?  You could create
> compile-command by using 'eval', which can accept Emacs functions.

Indeed, so I don't think there's anything here to be fixed.  Closing.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 6615 <at> debbugs.gnu.org and jidanni <at> jidanni.org Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 01 Oct 2019 19:29:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6615; Package emacs. (Tue, 01 Oct 2019 19:45:03 GMT) Full text and rfc822 format available.

Message #19 received at 6615 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 34130 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, 6615 <at> debbugs.gnu.org
Subject: Re: bug#34130: Specifying File Variables: mention why can't specify
 "current file"
Date: Wed, 02 Oct 2019 03:44:37 +0800
>>>>> "LI" == Lars Ingebrigtsen <larsi <at> gnus.org> writes:
LI> Eli Zaretskii <eliz <at> gnu.org> writes:

>>> On (info "(emacs) Specifying File Variables")
>>> at
>>> 
>>> # Local Variables:
>>> # compile-command: "cc foo.c -Dfoo=bar -Dhack=whatever \
>>> #   -Dmumble=blaah"
>>> # End:
>>> 
>>> do also mention why there is absolutely no way to say "<<<current file>>>",
>>> $$$${current_file} etc. if one wanted to, instead of needing to hardwire
>>> the filename (foo.c) of the file (foo.c) into the file (foo.c) itself! Thanks.
>> 
>> Is something wrong with using buffer-file-name?  You could create
>> compile-command by using 'eval', which can accept Emacs functions.

LI> Indeed, so I don't think there's anything here to be fixed.  Closing.

eval needs to be whitelisted as a safe local variable, creating a security hole.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6615; Package emacs. (Wed, 02 Oct 2019 11:49:02 GMT) Full text and rfc822 format available.

Message #22 received at 6615 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 34130 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>,
 6615 <at> debbugs.gnu.org
Subject: Re: bug#6615: bug#34130: Specifying File Variables: mention why
 can't specify "current file"
Date: Wed, 02 Oct 2019 13:48:28 +0200
>>>>> On Wed, 02 Oct 2019 03:44:37 +0800, 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> said:

>>>>> "LI" == Lars Ingebrigtsen <larsi <at> gnus.org> writes:
    LI> Eli Zaretskii <eliz <at> gnu.org> writes:

    >>>> On (info "(emacs) Specifying File Variables")
    >>>> at
    >>>> 
    >>>> # Local Variables:
    >>>> # compile-command: "cc foo.c -Dfoo=bar -Dhack=whatever \
    >>>> #   -Dmumble=blaah"
    >>>> # End:
    >>>> 
    >>>> do also mention why there is absolutely no way to say "<<<current file>>>",
    >>>> $$$${current_file} etc. if one wanted to, instead of needing to hardwire
    >>>> the filename (foo.c) of the file (foo.c) into the file (foo.c) itself! Thanks.
    >>> 
    >>> Is something wrong with using buffer-file-name?  You could create
    >>> compile-command by using 'eval', which can accept Emacs functions.

    LI> Indeed, so I don't think there's anything here to be fixed.  Closing.

    積丹尼> eval needs to be whitelisted as a safe local variable, creating a security hole.

How about this instead:

    before-hack-local-variables-hook is a variable defined in `files.el'.
    Its value is (c-before-hack-hook)

      This variable may be risky if used as a file-local variable.
      Probably introduced at or before Emacs version 23.1.

    Documentation:
    Normal hook run before setting file-local variables.
    It is called after checking for unsafe/risky variables and
    setting `file-local-variables-alist', and before applying the
    variables stored in `file-local-variables-alist'.  A hook
    function is allowed to change the contents of this alist.

    This hook is called only if there is at least one file-local
    variable to set.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6615; Package emacs. (Wed, 02 Oct 2019 19:12:03 GMT) Full text and rfc822 format available.

Message #25 received at 6615 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, 6615 <at> debbugs.gnu.org,
 34130 <at> debbugs.gnu.org
Subject: Re: bug#6615: bug#34130: Specifying File Variables: mention why can't
 specify "current file"
Date: Thu, 03 Oct 2019 03:11:13 +0800
>>>>> "RP" == Robert Pluim <rpluim <at> gmail.com> writes:

RP> How about this instead:

RP>     before-hack-local-variables-hook is a variable defined in `files.el'...

All I know is you need to add a paragraph explaining whatever workaround
recipe that is to (info "(emacs) Specifying File Variables"):

"You can even refer to the current file name using local variables!
Here's how: ...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6615; Package emacs. (Thu, 03 Oct 2019 08:26:02 GMT) Full text and rfc822 format available.

Message #28 received at 6615 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 34130 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>,
 6615 <at> debbugs.gnu.org
Subject: Re: bug#34130: bug#6615: bug#34130: Specifying File Variables:
 mention why can't specify "current file"
Date: Thu, 03 Oct 2019 10:25:12 +0200
>>>>> On Thu, 03 Oct 2019 03:11:13 +0800, 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> said:

>>>>> "RP" == Robert Pluim <rpluim <at> gmail.com> writes:
    RP> How about this instead:

    RP> before-hack-local-variables-hook is a variable defined in `files.el'...

    積丹尼> All I know is you need to add a paragraph explaining whatever workaround
    積丹尼> recipe that is to (info "(emacs) Specifying File Variables"):

    積丹尼> "You can even refer to the current file name using local variables!
    積丹尼> Here's how: ...

Not really, because itʼs not restricted to just that, you can do whatever
you want in the hook.

Robert




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6615; Package emacs. (Fri, 04 Oct 2019 08:12:02 GMT) Full text and rfc822 format available.

Message #31 received at 6615 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, 6615 <at> debbugs.gnu.org,
 34130 <at> debbugs.gnu.org
Subject: Re: bug#34130: bug#6615: bug#34130: Specifying File Variables:
 mention why can't specify "current file"
Date: Fri, 04 Oct 2019 16:11:17 +0800
Whatever you are proposing is too complex.

@CURRENT_FILE@ should just refer to the current file, no hacks needed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6615; Package emacs. (Fri, 04 Oct 2019 08:38:02 GMT) Full text and rfc822 format available.

Message #34 received at 6615 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 34130 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>,
 6615 <at> debbugs.gnu.org
Subject: Re: bug#34130: bug#6615: bug#34130: Specifying File Variables:
 mention why can't specify "current file"
Date: Fri, 04 Oct 2019 10:37:45 +0200
>>>>> On Fri, 04 Oct 2019 16:11:17 +0800, 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> said:

    積丹尼> Whatever you are proposing is too complex.
    積丹尼> @CURRENT_FILE@ should just refer to the current file, no hacks needed.

You propose @CURRENT_FILE@, someone else will prefer $..$, someone
else again will want a different set of variables available. This is
why the 'eval' functionality exists, which you donʼt want to use,
hence the proposal to use the hook.

Robert




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6615; Package emacs. (Fri, 04 Oct 2019 17:45:02 GMT) Full text and rfc822 format available.

Message #37 received at 6615 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 34130 <at> debbugs.gnu.org, 6615 <at> debbugs.gnu.org
Subject: Re: bug#34130: bug#6615: bug#34130: Specifying File Variables:
 mention why can't specify "current file"
Date: Sat, 05 Oct 2019 01:44:31 +0800
>>>>> "RP" == Robert Pluim <rpluim <at> gmail.com> writes:
>>>>> On Fri, 04 Oct 2019 16:11:17 +0800, 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> said:

積丹尼> Whatever you are proposing is too complex.
積丹尼> @CURRENT_FILE@ should just refer to the current file, no hacks needed.

RP> You propose @CURRENT_FILE@, someone else will prefer $..$, someone
RP> else again will want a different set of variables available. This is
RP> why the 'eval' functionality exists, which you donʼt want to use,
RP> hence the proposal to use the hook.

OK, please post what the INFO page would say
(easy instructions that even I could follow)
and I'll give it a spin. Any how about just
(setq current-file-local-variable "$CUR_FIL$")
for .emacs...
P.S., Dear Lars, To: doesn't mean you:
https://debbugs.gnu.org/cgi-bin/bugreport.cgi?bug=37591




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 02 Nov 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 170 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.