unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6615: document how to specify the current filename in Local Variables
@ 2010-07-12  4:19     ` jidanni
  2019-10-01 19:44       ` bug#6615: bug#34130: Specifying File Variables: mention why can't specify "current file" 積丹尼 Dan Jacobson
  2019-10-04 17:44       ` 積丹尼 Dan Jacobson
  0 siblings, 2 replies; 12+ messages in thread
From: jidanni @ 2010-07-12  4:19 UTC (permalink / raw)
  To: 6615

(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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#34130: Specifying File Variables: mention why can't specify "current file"
@ 2019-01-19  0:58 積丹尼 Dan Jacobson
  2019-01-19  7:24 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-01-19  0:58 UTC (permalink / raw)
  To: 34130

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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#34130: Specifying File Variables: mention why can't specify "current file"
  2019-01-19  0:58 bug#34130: Specifying File Variables: mention why can't specify "current file" 積丹尼 Dan Jacobson
@ 2019-01-19  7:24 ` Eli Zaretskii
  2019-01-19 11:26   ` Glenn Morris
  2019-10-01 19:28   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 12+ messages in thread
From: Eli Zaretskii @ 2019-01-19  7:24 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 34130

> From: 積丹尼 Dan Jacobson
> 	<jidanni@jidanni.org>
> Date: Sat, 19 Jan 2019 08:58:39 +0800
> 
> 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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#34130: Specifying File Variables: mention why can't specify "current file"
  2019-01-19  7:24 ` Eli Zaretskii
@ 2019-01-19 11:26   ` Glenn Morris
  2019-10-01 19:28   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 12+ messages in thread
From: Glenn Morris @ 2019-01-19 11:26 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson, 34130


This is the third time you've reported this.

You can avoid this by checking
https://debbugs.gnu.org/cgi/pkgreport.cgi?submitter=jidanni%40jidanni.org
before you post.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#34130: Specifying File Variables: mention why can't specify "current file"
  2019-01-19  7:24 ` Eli Zaretskii
  2019-01-19 11:26   ` Glenn Morris
@ 2019-10-01 19:28   ` Lars Ingebrigtsen
  2010-07-12  4:19     ` bug#6615: document how to specify the current filename in Local Variables jidanni
  1 sibling, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-01 19:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 6615, 34130, 積丹尼 Dan Jacobson

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6615: bug#34130: Specifying File Variables: mention why can't specify "current file"
  2010-07-12  4:19     ` bug#6615: document how to specify the current filename in Local Variables jidanni
@ 2019-10-01 19:44       ` 積丹尼 Dan Jacobson
  2019-10-02 11:48         ` Robert Pluim
  2019-10-04 17:44       ` 積丹尼 Dan Jacobson
  1 sibling, 1 reply; 12+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-10-01 19:44 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 6615, 34130

>>>>> "LI" == Lars Ingebrigtsen <larsi@gnus.org> writes:
LI> Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6615: bug#34130: Specifying File Variables: mention why can't specify "current file"
  2019-10-01 19:44       ` bug#6615: bug#34130: Specifying File Variables: mention why can't specify "current file" 積丹尼 Dan Jacobson
@ 2019-10-02 11:48         ` Robert Pluim
  2019-10-02 19:11           ` bug#34130: " 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 12+ messages in thread
From: Robert Pluim @ 2019-10-02 11:48 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 6615, Lars Ingebrigtsen, 34130

>>>>> On Wed, 02 Oct 2019 03:44:37 +0800, 積丹尼 Dan Jacobson <jidanni@jidanni.org> said:

>>>>> "LI" == Lars Ingebrigtsen <larsi@gnus.org> writes:
    LI> Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#34130: bug#6615: bug#34130: Specifying File Variables: mention why can't specify "current file"
  2019-10-02 11:48         ` Robert Pluim
@ 2019-10-02 19:11           ` 積丹尼 Dan Jacobson
  2019-10-03  8:25             ` bug#6615: " Robert Pluim
  0 siblings, 1 reply; 12+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-10-02 19:11 UTC (permalink / raw)
  To: Lars Ingebrigtsen, 6615, 34130

>>>>> "RP" == Robert Pluim <rpluim@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: ...





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6615: bug#34130: bug#6615: bug#34130: Specifying File Variables: mention why can't specify "current file"
  2019-10-02 19:11           ` bug#34130: " 積丹尼 Dan Jacobson
@ 2019-10-03  8:25             ` Robert Pluim
  2019-10-04  8:11               ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 12+ messages in thread
From: Robert Pluim @ 2019-10-03  8:25 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 6615, Lars Ingebrigtsen, 34130

>>>>> On Thu, 03 Oct 2019 03:11:13 +0800, 積丹尼 Dan Jacobson <jidanni@jidanni.org> said:

>>>>> "RP" == Robert Pluim <rpluim@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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#34130: bug#6615: bug#34130: Specifying File Variables: mention why can't specify "current file"
  2019-10-03  8:25             ` bug#6615: " Robert Pluim
@ 2019-10-04  8:11               ` 積丹尼 Dan Jacobson
  2019-10-04  8:37                 ` bug#6615: " Robert Pluim
  0 siblings, 1 reply; 12+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-10-04  8:11 UTC (permalink / raw)
  To: Lars Ingebrigtsen, 6615, 34130

Whatever you are proposing is too complex.

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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6615: bug#34130: bug#6615: bug#34130: Specifying File Variables: mention why can't specify "current file"
  2019-10-04  8:11               ` 積丹尼 Dan Jacobson
@ 2019-10-04  8:37                 ` Robert Pluim
  0 siblings, 0 replies; 12+ messages in thread
From: Robert Pluim @ 2019-10-04  8:37 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 6615, Lars Ingebrigtsen, 34130

>>>>> On Fri, 04 Oct 2019 16:11:17 +0800, 積丹尼 Dan Jacobson <jidanni@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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6615: bug#34130: bug#6615: bug#34130: Specifying File Variables: mention why can't specify "current file"
  2010-07-12  4:19     ` bug#6615: document how to specify the current filename in Local Variables jidanni
  2019-10-01 19:44       ` bug#6615: bug#34130: Specifying File Variables: mention why can't specify "current file" 積丹尼 Dan Jacobson
@ 2019-10-04 17:44       ` 積丹尼 Dan Jacobson
  1 sibling, 0 replies; 12+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-10-04 17:44 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 6615, 34130

>>>>> "RP" == Robert Pluim <rpluim@gmail.com> writes:
>>>>> On Fri, 04 Oct 2019 16:11:17 +0800, 積丹尼 Dan Jacobson <jidanni@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





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-10-04 17:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-19  0:58 bug#34130: Specifying File Variables: mention why can't specify "current file" 積丹尼 Dan Jacobson
2019-01-19  7:24 ` Eli Zaretskii
2019-01-19 11:26   ` Glenn Morris
2019-10-01 19:28   ` Lars Ingebrigtsen
2010-07-12  4:19     ` bug#6615: document how to specify the current filename in Local Variables jidanni
2019-10-01 19:44       ` bug#6615: bug#34130: Specifying File Variables: mention why can't specify "current file" 積丹尼 Dan Jacobson
2019-10-02 11:48         ` Robert Pluim
2019-10-02 19:11           ` bug#34130: " 積丹尼 Dan Jacobson
2019-10-03  8:25             ` bug#6615: " Robert Pluim
2019-10-04  8:11               ` 積丹尼 Dan Jacobson
2019-10-04  8:37                 ` bug#6615: " Robert Pluim
2019-10-04 17:44       ` 積丹尼 Dan Jacobson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).