From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.bugs Subject: Re: longish Local Variables in Files Date: Mon, 30 Aug 2004 12:21:43 -0600 Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <41337037.5030802@yahoo.com> References: <412A5A6B.6000508@yahoo.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1093890152 3298 80.91.224.253 (30 Aug 2004 18:22:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 30 Aug 2004 18:22:32 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 30 20:22:09 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C1qnA-0004s2-00 for ; Mon, 30 Aug 2004 20:22:08 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C1qrz-0004Zd-35 for geb-bug-gnu-emacs@m.gmane.org; Mon, 30 Aug 2004 14:27:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C1qrw-0004ZL-OW for bug-gnu-emacs@gnu.org; Mon, 30 Aug 2004 14:27:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C1qrv-0004Z2-Vb for bug-gnu-emacs@gnu.org; Mon, 30 Aug 2004 14:27:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C1qrv-0004Yz-Ry for bug-gnu-emacs@gnu.org; Mon, 30 Aug 2004 14:27:03 -0400 Original-Received: from [130.59.10.2] (helo=chx400.switch.ch) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1C1qmp-0004lT-6T for bug-gnu-emacs@gnu.org; Mon, 30 Aug 2004 14:21:47 -0400 Original-Received: from mail.fu-berlin.de ([130.133.1.2]) by chx400.switch.ch with esmtp (Exim 3.20 #1) id 1C1qmn-0001iM-00 for gnu-emacs-bug@moderators.isc.org; Mon, 30 Aug 2004 20:21:45 +0200 Original-Received: by Mail.FU-Berlin.DE (Exim 4.42) from curry.zedat.fu-berlin.de ([160.45.10.36]) for gnu-emacs-bug@moderators.isc.org with esmtp id <1C1qmm-000Exz-8v>; Mon, 30 Aug 2004 20:21:44 +0200 Original-Received: by Curry.ZEDAT.FU-Berlin.DE (Smail3.2.0.98) from news.uni-berlin.de with bsmtp id ; Mon, 30 Aug 2004 20:21:44 +0200 (MEST) Original-To: gnu-emacs-bug@moderators.isc.org Original-Path: not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 69 X-Orig-X-Trace: news.uni-berlin.de CY/SsNiWDC4mPdFdGZXbzQQzZnKBH6epW1UTS+5odC8Dl5+3M= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:8863 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:8863 Dan Jacobson wrote: > K> Then you are out of luck: file local variables must be specified on a > K> single line. > > Make sure this is documented. Wait, I demonstrated that it could be > done on two lines. OK, I see now why that works: hack-local-variables reads the value as a Lisp expression, not as a line. So Lisp objects whose readable syntax can span multiple lines (strings, lists, and vectors -- are there any others?) can be specified with embedded newlines as values for file local variables. The key thing to remember is that the newlines, local variable prefix, and local variable suffix are not ignored or discarded by the (read (current-buffer)) function call when the occur within "...". So in your compile-command example, they are all present in the variable's value. Within a list or vector value, though, the prefix and suffix may be significant. > K> What's wrong with having a really long compile-command > K> line in your script? > > I don't want lines to wrap etc. on my terminal or printer. Call me old > fashioned. I agree readability is a good thing, I just wanted to make sure it wasn't a functional requirement. > rms> # compile-command: "invoke-rc.d chrony restart && sleep 2`\ > rms> #` && grep chrony /var/log/syslog|tail -19" > > Indeed that works, no need for /bin/sh's ":", and one can even remove > the backslash. That's because the backslash occurs within "..." and is interpreted the same as within any string: the following newline is ignored. > One can go on and on: > > # Local Variables: > # compile-command: "p=$PWD && cd /tmp && procmail -m LOGABSTRACT=all ` > #` VERBOSE=on $p/.procmailrc.local.post #` bla bla" > # End: We can't recommend the use of backquote-newline-backquote in a shell command. RMS' example above (backquote-backslash-newline-pound sign-backquote) is even worse. > OK, remember to document this `#` hack. As this always is sent to sh, > this should always work. And document simpler ways for those who > don't need to hide local variables in comments, e.g., > > rms> # compile-command: "invoke-rc.d chrony restart && sleep 2 \ > rms> && grep chrony /var/log/syslog|tail -19" The # hack is unnecessary and potentially confusing. RMS' example clearly demonstrates the right way to do this. I think it might be worthwhile explaining that string etc. values for file local variables may span multiple lines and that the local variable prefix can interfere with the intended value; but that should be explained in the Emacs Lisp manual, not the Emacs manual. -- Kevin Rodgers