GNU bug report logs - #16846
24.3.50.1; Info 48.2.4.1 Specifying File Variables

Previous Next

Package: emacs;

Reported by: Andreas Röhler <andreas.roehler <at> easy-emacs.de>

Date: Sat, 22 Feb 2014 20:08:01 UTC

Severity: normal

Tags: notabug

Merged with 16836

Found in version 24.3.50.1

Done: Juanma Barranquero <lekktu <at> gmail.com>

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 16846 in the body.
You can then email your comments to 16846 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 bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Sat, 22 Feb 2014 20:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Röhler <andreas.roehler <at> easy-emacs.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 22 Feb 2014 20:08:02 GMT) Full text and rfc822 format available.

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

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50.1; Info 48.2.4.1 Specifying File Variables
Date: Sat, 22 Feb 2014 21:11:36 +0100
48.2.4.1 Specifying File Variables

Doesn't mention the required ";;;" before, saying:

..................................

There are two ways to specify file local variable values: in the first
line, or with a local variables list.  Here's how to specify them in the
first line:

     -*- mode: MODENAME; VAR: VALUE; ... -*-

;;;;;;;;;

see also bug-report bug#16836

GNU Emacs 24.3.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2014-02-19




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Sat, 22 Feb 2014 20:30:02 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: 16846 <at> debbugs.gnu.org
Subject: Re: bug#16846: 24.3.50.1; Info 48.2.4.1 Specifying File Variables
Date: Sat, 22 Feb 2014 21:29:03 +0100
merge 16836 16846
quit


On Sat, Feb 22, 2014 at 9:11 PM, Andreas Röhler
<andreas.roehler <at> easy-emacs.de> wrote:
> 48.2.4.1 Specifying File Variables
>
> Doesn't mention the required ";;;" before, saying:

It's not that ";;;" is required. The line used to specify local
variables is usually a comment because presumably the file is to be
processed by some kind of program (a compiler or interpreter, for
program source files, for example).

If you start an elisp file with

-*- mode: emacs-lisp; tab-width: 4 -*-

Emacs will have no trouble understanding the variables. Edit the file
and you'll see that it is in emacs-lisp-mode and tab-width is 4. But
when you eval the buffer, as you did in your bug#16836 report, Emacs
complains that the line is not valid Elisp code.

> see also bug-report bug#16836

Why have you filed two bug reports for the same thing?




Merged 16836 16846. Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 22 Feb 2014 20:40:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 16836 <at> debbugs.gnu.org and Andreas Röhler <andreas.roehler <at> easy-emacs.de> Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 22 Feb 2014 20:40:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Sat, 22 Feb 2014 20:43:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 16846 <at> debbugs.gnu.org
Subject: Re: [debbugs-tracker] Processed: your mail
Date: Sat, 22 Feb 2014 15:42:13 -0500
GNU bug tracker automated control server wrote:

> Processing commands for control <at> debbugs.gnu.org:
>
>> reopen 16836
>> merge 16836 16846
>> close 16836

aka:

forcemerge 16836 16846




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Sat, 22 Feb 2014 20:47:02 GMT) Full text and rfc822 format available.

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

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: 16846 <at> debbugs.gnu.org
Subject: Re: bug#16846 acknowledged by developer ()
Date: Sat, 22 Feb 2014 21:50:30 +0100
Am 22.02.2014 21:40, schrieb GNU bug Tracking System:
> This is an automatic notification regarding your bug report
> #16846: 24.3.50.1; Info 48.2.4.1 Specifying File Variables,
> which was filed against the emacs package.
>
> Thank you for your report, which has now been closed.
> You can view the full report at
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16846
>
> If you require further information, please followup to 16846 <at> debbugs.gnu.org.
>
> debbugs.gnu.org maintainers
> (administrator, GNU bugs database)
>
>

re-open bug#16846

This bug is about Info files, the former report was about a wrong compiler warning.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Sat, 22 Feb 2014 22:45:03 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: 16846 <at> debbugs.gnu.org
Subject: Re: bug#16846: acknowledged by developer ()
Date: Sat, 22 Feb 2014 23:43:59 +0100
On Sat, Feb 22, 2014 at 9:50 PM, Andreas Röhler
<andreas.roehler <at> easy-emacs.de> wrote:

> This bug is about Info files

I don't think there is a bug. That info node talks about the format of
the file variables, but of course says nothing about the format of the
contents of your file. If your file is text, perhaps just

-*- variable: value -*-

in the first line is perfectly acceptable. If the file contains C
source code, or elisp, or another data format to be digested by some
external processor, it should already be clear that the file variables
must be acceptable to these external processors. You can't expect to
have

-*- mode: c -*-

as the first line of a C file and compile it with GCC without getting an error.

That said, the same node that you quote already says:

     Here is an example first line that specifies Lisp mode and sets two
  variables with numeric values:

       ;; -*- mode: Lisp; fill-column: 75; comment-column: 50; -*-

and a little later:

     In shell scripts, the first line is used to identify the script
  interpreter, so you cannot put any local variables there.  To
  accommodate this, Emacs looks for local variable specifications in the
  _second_ line if the first line specifies an interpreter.  The same is
  true for man pages which start with the magic string `'\"' to specify a
  list of troff preprocessors (not all do, however).

which clearly suggests that the file variables must also be acceptable
to the consumer of the file.

>, the former report was about a wrong compiler warning.

Which was, in fact, not wrong at all.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Sun, 23 Feb 2014 08:46:01 GMT) Full text and rfc822 format available.

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

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 16846 <at> debbugs.gnu.org
Subject: Re: bug#16846: acknowledged by developer ()
Date: Sun, 23 Feb 2014 09:49:09 +0100
[Message part 1 (text/plain, inline)]
Am 22.02.2014 23:43, schrieb Juanma Barranquero:
> On Sat, Feb 22, 2014 at 9:50 PM, Andreas Röhler
> <andreas.roehler <at> easy-emacs.de> wrote:
>
>> This bug is about Info files
>
> I don't think there is a bug. That info node talks about the format of
> the file variables, but of course says nothing about the format of the
> contents of your file. If your file is text, perhaps just
>
> -*- variable: value -*-
>
> in the first line is perfectly acceptable.


Do you want  file-local variables restrict to text-mode?
Doesn't make sense for me.


 If the file contains C
> source code, or elisp, or another data format to be digested by some
> external processor, it should already be clear that the file variables
> must be acceptable to these external processors. You can't expect to
> have
>
> -*- mode: c -*-
>
> as the first line of a C file and compile it with GCC without getting an error.
>

We must not discuss possible other bugs here. Let's stay with the reported one.

> That said, the same node that you quote already says:
>
>       Here is an example first line that specifies Lisp mode and sets two
>    variables with numeric values:
>
>         ;; -*- mode: Lisp; fill-column: 75; comment-column: 50; -*-
>
> and a little later:
>
>       In shell scripts, the first line is used to identify the script
>    interpreter, so you cannot put any local variables there.  To
>    accommodate this, Emacs looks for local variable specifications in the
>    _second_ line if the first line specifies an interpreter.  The same is
>    true for man pages which start with the magic string `'\"' to specify a
>    list of troff preprocessors (not all do, however).
>
> which clearly suggests that the file variables must also be acceptable
> to the consumer of the file.

It rather says: implementation is not that straightforward as it could/should be.
It's at Emacs, when sending code, to clear its artistics before.

>
>> , the former report was about a wrong compiler warning.
>
> Which was, in fact, not wrong at all.
>

Attach foo1.png - happens when evaluating a buffer with contents:

;;;;;;


-*- lexical-binding: t -*-

(setq foo 1)

;;;;;;

[foo1.png (image/png, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Sun, 23 Feb 2014 11:08:02 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: 16846 <at> debbugs.gnu.org
Subject: Re: bug#16846: acknowledged by developer ()
Date: Sun, 23 Feb 2014 12:07:06 +0100
On Sun, Feb 23, 2014 at 9:49 AM, Andreas Röhler
<andreas.roehler <at> easy-emacs.de> wrote:

> Do you want  file-local variables restrict to text-mode?

That's a non sequitur.

> We must not discuss possible other bugs here. Let's stay with the reported
> one.

I see no bug. Neither the "possible other" nor the reported one.

> It rather says: implementation is not that straightforward as it
> could/should be.

It says nothing of the sort. It says: an elisp file with file
variables should still be an elisp file, a C one still has to have C
syntax, etc.

> It's at Emacs, when sending code, to clear its artistics before.

And, somehow, if you have a C file edited with Emacs and having a file
variable line, Emacs is to somehow know when you're about to compile
that file (outside Emacs) and "clear its artistics". Sorry, but it
makes no sense.

> Attach foo1.png - happens when evaluating a buffer with contents:
>
> ;;;;;;
>
>
> -*- lexical-binding: t -*-
>
> (setq foo 1)
>
> ;;;;;;

I still see no bug.

The way it works makes sense, and it's how it has worked for years. If
you want to file a bug report about the info node not being clear
enough of the obvious need to put the file variables in a comment or
another suitable way to protect them from the file content's consumer,
please suit yourself. But the behavior that you're suggesting, that
somehow Emacs should remove the file variables before passing it (to
the Elisp interpreter or anywhere else) is not going to be
implemented.

   J




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Mon, 24 Feb 2014 12:46:01 GMT) Full text and rfc822 format available.

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

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 16846 <at> debbugs.gnu.org
Subject: Re: bug#16846: acknowledged by developer ()
Date: Mon, 24 Feb 2014 13:49:45 +0100
Am 23.02.2014 12:07, schrieb Juanma Barranquero:

>> Attach foo1.png - happens when evaluating a buffer with contents:
>>
>> ;;;;;;
>>
>>
>> -*- lexical-binding: t -*-
>>
>> (setq foo 1)
>>
>> ;;;;;;
>
> I still see no bug.
>
> The way it works makes sense, and it's how it has worked for years.

 It works but sends an error.
Sending the error upon working code is a bug.

Or you say: a single file local setting needs to be commented, more of them not.

If a comment is needed, it's a docu-bug.







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Mon, 24 Feb 2014 12:52:01 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: 16846 <at> debbugs.gnu.org
Subject: Re: bug#16846: acknowledged by developer ()
Date: Mon, 24 Feb 2014 13:50:39 +0100
On Mon, Feb 24, 2014 at 1:49 PM, Andreas Röhler
<andreas.roehler <at> easy-emacs.de> wrote:

>  It works but sends an error.

As it would if you instead of

  -*- variable: value -*-

put

  This line is here just to mess with the interpreter

So, if you don't want to mess with the program that process the file,
follow the file's intended conventions. Nothing to do with file
variables.

> Sending the error upon working code is a bug.

No, its not. That line is not valid elisp.

> Or you say: a single file local setting needs to be commented, more of them
> not.

Sorry, I don't understand you.

> If a comment is needed, it's a docu-bug.

As I already said, if you think the info manual needs to be more
explicit about the implicit (but obvious) need to respect the
conventions of the kind of file you're writing (whether source code,
or any other kind), please file a bug report saying so.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Mon, 24 Feb 2014 13:39:02 GMT) Full text and rfc822 format available.

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

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 16846 <at> debbugs.gnu.org
Subject: Re: bug#16846: acknowledged by developer ()
Date: Mon, 24 Feb 2014 14:42:58 +0100
Am 24.02.2014 13:50, schrieb Juanma Barranquero:
> On Mon, Feb 24, 2014 at 1:49 PM, Andreas Röhler
> <andreas.roehler <at> easy-emacs.de> wrote:
>
>>   It works but sends an error.
>
> As it would if you instead of
>
>    -*- variable: value -*-
>
> put
>
>    This line is here just to mess with the interpreter
>
> So, if you don't want to mess with the program that process the file,
> follow the file's intended conventions. Nothing to do with file
> variables.

Please tell me, what's the difference between this example and the one given in the info:


     -*- mode: MODENAME; VAR: VALUE; ... -*-

beside specified just one?

>
>> Sending the error upon working code is a bug.
>
> No, its not. That line is not valid elisp.
>
>> Or you say: a single file local setting needs to be commented, more of them
>> not.
>
> Sorry, I don't understand you.
>
>> If a comment is needed, it's a docu-bug.
>
> As I already said, if you think the info manual needs to be more
> explicit about the implicit (but obvious) need to respect the
> conventions of the kind of file you're writing (whether source code,
> or any other kind), please file a bug report saying so.
>

This was done with #16846





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Mon, 24 Feb 2014 13:42:02 GMT) Full text and rfc822 format available.

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

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: Juanma Barranquero <lekktu <at> gmail.com>, 16846 <at> debbugs.gnu.org
Subject: Re: bug#16846: acknowledged by developer ()
Date: Mon, 24 Feb 2014 14:41:18 +0100
Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:
>>> -*- lexical-binding: t -*-
>  It works but sends an error.
> Sending the error upon working code is a bug.

It might help if you say why do you write the line "-*- lexical-binding:
t -*-", and in particular why you did not add comment syntax (i.e. semi
colons) at the beginning of it. What doc did you read that lead you to
write that ?

> Or you say: a single file local setting needs to be commented, more of them not.
>
> If a comment is needed, it's a docu-bug.

I might indeed suggest that in
(info "(elisp) Using Lexical Binding")
a direct xref to
(info "(emacs) Specifying File Variables")
could help to know what "first line" means in that context, because it's
not obvious from the elisp manual itself.

-- 
Nico.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Mon, 24 Feb 2014 15:56:02 GMT) Full text and rfc822 format available.

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

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: Juanma Barranquero <lekktu <at> gmail.com>, 16846 <at> debbugs.gnu.org
Subject: Re: bug#16846: acknowledged by developer ()
Date: Mon, 24 Feb 2014 16:59:57 +0100
Am 24.02.2014 14:41, schrieb Nicolas Richard:
> Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:
>>>> -*- lexical-binding: t -*-
>>   It works but sends an error.
>> Sending the error upon working code is a bug.
>
> It might help if you say why do you write the line "-*- lexical-binding:
> t -*-",

Just an example here, want lexical-binding in buffer.

and in particular why you did not add comment syntax (i.e. semi
> colons) at the beginning of it. What doc did you read that lead you to
> write that ?
>

I'm referring to:

48.2.4.1 Specifying File Variables
..................................

There are two ways to specify file local variable values: in the first
line, or with a local variables list.  Here's how to specify them in the
first line:

     -*- mode: MODENAME; VAR: VALUE; ... -*-

You can specify any number of variable/value pairs in this way, each
pair with a colon and semicolon.

;;;;;;;


BTW left out the semicolon as understood it's to separate pairs.
The error

Symbol's value as variable is void: -*-

is signaled too with semicolon added.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Mon, 24 Feb 2014 16:07:01 GMT) Full text and rfc822 format available.

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

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>, 16846 <at> debbugs.gnu.org,
 Juanma Barranquero <lekktu <at> gmail.com>
Subject: Re: bug#16846: acknowledged by developer ()
Date: Mon, 24 Feb 2014 17:06:29 +0100
Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:
> Am 24.02.2014 14:41, schrieb Nicolas Richard:
>> and in particular why you did not add comment syntax (i.e. semi
>> colons) at the beginning of it. What doc did you read that lead you to
>> write that ?
>>
>
> I'm referring to:
>
> 48.2.4.1 Specifying File Variables

That part of the doc doesn't say that you shouldn't write anything else
on that line. In particular, you should at least make that line valid in
the context of that file (e.g. make it a comment if it's a programming
language). Using M-x add-file-local-variable-prop-line, which is
suggested in the doc, should do that for you in most modes (and does for
emacs-lisp).

> BTW left out the semicolon as understood it's to separate pairs.

I meant semicolons at the beginning of line, i.e. to turn the line into
a comment.

-- 
Nico.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16846; Package emacs. (Mon, 24 Feb 2014 16:46:03 GMT) Full text and rfc822 format available.

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

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: Juanma Barranquero <lekktu <at> gmail.com>, 16846 <at> debbugs.gnu.org
Subject: Re: bug#16846: acknowledged by developer ()
Date: Mon, 24 Feb 2014 17:49:24 +0100
Am 24.02.2014 17:06, schrieb Nicolas Richard:
> Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:
>> Am 24.02.2014 14:41, schrieb Nicolas Richard:
>>> and in particular why you did not add comment syntax (i.e. semi
>>> colons) at the beginning of it. What doc did you read that lead you to
>>> write that ?
>>>
>>
>> I'm referring to:
>>
>> 48.2.4.1 Specifying File Variables
>
> That part of the doc doesn't say that you shouldn't write anything else
> on that line.

It formulates a general example which isn't general. It's misleading.

A better start would be the Emacs Lisp example below, followed by a hint WRT to plain text-modes.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 25 Mar 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 87 days ago.

Previous Next


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