bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: longish Local Variables in Files


From: Kevin Rodgers
Subject: Re: longish Local Variables in Files
Date: Tue, 31 Aug 2004 14:27:33 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Dan Jacobson wrote:
> K> We can't recommend the use of backquote-newline-backquote in a shell
> K> command.
>
> K> The # hack is unnecessary and potentially confusing.
>
> But we often need the #'s to hide from what is scanning the file. OK?
> So there should be examples given for when you need #, and when you
> don't.

Ah, right.  I think the local variable prefix comment string is needed
for successive lines when they can't be continued via a trailing
backslash on the preceding line.  One example where comments can be
continued across line breaks that comes to mind is Tcl/Tk:

# This is obviously a comment \
  and this is a comment as well, but not so obviously.

> Let's see, also there's long lines for .el's where we use ";" to hide,
> "!" is used in .Xresources, etc. etc.  I suppose all these would hide
> behind a ... `#
> ;`...
>
> or
>
>  ....`#
> !`...

It depends completely on the format of the file.  If it's a program,
it depends both on the syntax of the programming language at both the
lexical and grammatical levels; if it's a text file, it depends on the
syntax of the markup language at both levels.  It is far too
idiosyncratic to generalize, but it might be worthwhile to include
shell and lisp programming language examples.

> Untested. Ok, document all this. Perhaps test first.

Perhaps?

> K> that should be explained in the Emacs Lisp manual, not the Emacs manual.
>
> anyways, my collection of hacks are intended for a small cookbook
> section in the Emacs manual.
>
> Document is soon as this topic is about to get boring.

It may be boring, but it's still not solved.

The alternative implementation I'd like to propose is that the local
variable prefix and suffix be ignored, by copying the local variables
section (minus the "Local variables:" header and "End:" footer lines)
to a temporary buffer and deleting the the prefix and suffix from each
line before parsing the "variable: value" pairs.  Then your original
example would be simply:

# Local variables:
# compile-command: "invoke-rc.d chrony restart && sleep 2 && \
# grep chrony /var/log/syslog|tail -19"
# End:

The temporary buffer would contain just:

compile-command: "invoke-rc.d chrony restart && sleep 2 && \
grep chrony /var/log/syslog|tail -19"

and the backslashed newline in the string value would be discarded by
Emacs' read function.

--
Kevin Rodgers





reply via email to

[Prev in Thread] Current Thread [Next in Thread]