unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* CheckDoc and package.el versus file variable prop lines
@ 2013-02-25 16:48 Sebastian Wiesner
  2013-02-25 19:37 ` Glenn Morris
  2013-02-25 20:13 ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Sebastian Wiesner @ 2013-02-25 16:48 UTC (permalink / raw)
  To: emacs-devel

Hello,

I am observing a little fight between package.el and Checkdoc on the
one side, or generally packaging conventions, and local file
variables, most notably "lexical-binding".

According to the documentation, "lexical-binding" must be set in the
*first line* the file, e.g. by "add-file-local-variable-prop-line".

Doing so, I get a "foo.el" with the following contents:

;; -*- lexical-binding: t; -*-
;;; foo.el --- Random stuff

;; Author: Sebastian Wiesner <lunaryorn@gmail.com>
;; Version: 0.1

;;; Code:

(message "Hello world")

(provide 'foo)

;;; foo.el ends here

However, on GNU Emacs 24.2.93.1 "C-x u M-x checkdoc-current-buffer"
prints the following warnings:

*** foo.el: checkdoc-current-buffer V 0.6.1
foo.el:0: The first line should be of the form: ";;; package --- Summary"
foo.el:0: You should have a section marked ";;; Commentary:"

Note the first warning.  It complains about "foo.el" not having a
proper package header on the *first line*.

Moreover, if I install "foo.el" with "package-install-file" everything
before the package header is *dropped*, i.e. the whole file variable
line is simply omitted, silently reverting my lexically scoped code
back to dynamic scoping *without any warning*.

So obviously both, "package.el" and Checkdoc on the on side, and file
local variables on the side, rigidly claim the first line of the file
for their own purposes, creating an unsolvable conflict for me.

How can I get lexical scoping working for a package, *without* it
being silently dropped on installation, and *without* checkdoc
warnings?

Greetings,
Sebastian Wiesner



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

* Re: CheckDoc and package.el versus file variable prop lines
  2013-02-25 16:48 CheckDoc and package.el versus file variable prop lines Sebastian Wiesner
@ 2013-02-25 19:37 ` Glenn Morris
  2013-02-26 13:48   ` Sebastian Wiesner
  2013-02-25 20:13 ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2013-02-25 19:37 UTC (permalink / raw)
  To: Sebastian Wiesner; +Cc: emacs-devel

Sebastian Wiesner wrote:

> How can I get lexical scoping working for a package, *without* it
> being silently dropped on installation, and *without* checkdoc
> warnings?

Why not do what existing packages do?

;;; pcmpl-ack.el --- completion for ack tool  -*- lexical-binding: t; -*-



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

* Re: CheckDoc and package.el versus file variable prop lines
  2013-02-25 16:48 CheckDoc and package.el versus file variable prop lines Sebastian Wiesner
  2013-02-25 19:37 ` Glenn Morris
@ 2013-02-25 20:13 ` Stefan Monnier
  2013-02-25 22:53   ` Xue Fuqiao
  2013-02-26 13:52   ` Sebastian Wiesner
  1 sibling, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2013-02-25 20:13 UTC (permalink / raw)
  To: Sebastian Wiesner; +Cc: emacs-devel

> Doing so, I get a "foo.el" with the following contents:

> ;; -*- lexical-binding: t; -*-
> ;;; foo.el --- Random stuff

Please report this via M-x report-emacs-bug (so we get a bug-number for it).

> How can I get lexical scoping working for a package, *without* it
> being silently dropped on installation, and *without* checkdoc
> warnings?

Use

  ;;; foo.el --- Random stuff  -*- lexical-binding: t -*-

It's a bit ugly, especially because it tends to go past the 80-column
limit, but that's the "standard" way to do it (and that's what
add-file-local-variable-prop-line should use in Elisp).


        Stefan



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

* Re: CheckDoc and package.el versus file variable prop lines
  2013-02-25 20:13 ` Stefan Monnier
@ 2013-02-25 22:53   ` Xue Fuqiao
  2013-02-25 23:01     ` Christopher Schmidt
  2013-02-26  0:00     ` Stefan Monnier
  2013-02-26 13:52   ` Sebastian Wiesner
  1 sibling, 2 replies; 9+ messages in thread
From: Xue Fuqiao @ 2013-02-25 22:53 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Sebastian Wiesner, emacs-devel

On Mon, 25 Feb 2013 15:13:08 -0500
Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> Use
> 
>   ;;; foo.el --- Random stuff  -*- lexical-binding: t -*-
> It's a bit ugly, especially because it tends to go past the 80-column
> limit, but that's the "standard" way to do it (and that's what
> add-file-local-variable-prop-line should use in Elisp).

If this would make the first line too long, maybe we can use a Local Variables
section at the end of the file. 

>         Stefan

-- 
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao



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

* Re: CheckDoc and package.el versus file variable prop lines
  2013-02-25 22:53   ` Xue Fuqiao
@ 2013-02-25 23:01     ` Christopher Schmidt
  2013-02-26 10:39       ` Xue Fuqiao
  2013-02-26  0:00     ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Christopher Schmidt @ 2013-02-25 23:01 UTC (permalink / raw)
  To: emacs-devel

Xue Fuqiao <xfq.free@gmail.com> writes:
> If this would make the first line too long, maybe we can use a Local
> Variables section at the end of the file.

That is not a good idea.  Check bug 12049.

        Christopher



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

* Re: CheckDoc and package.el versus file variable prop lines
  2013-02-25 22:53   ` Xue Fuqiao
  2013-02-25 23:01     ` Christopher Schmidt
@ 2013-02-26  0:00     ` Stefan Monnier
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2013-02-26  0:00 UTC (permalink / raw)
  To: Xue Fuqiao; +Cc: Sebastian Wiesner, emacs-devel

> If this would make the first line too long, maybe we can use a Local
> Variables section at the end of the file. 

No: a lexical-binding setting can only be at the beginning of the file,
at the end.


        Stefan



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

* Re: CheckDoc and package.el versus file variable prop lines
  2013-02-25 23:01     ` Christopher Schmidt
@ 2013-02-26 10:39       ` Xue Fuqiao
  0 siblings, 0 replies; 9+ messages in thread
From: Xue Fuqiao @ 2013-02-26 10:39 UTC (permalink / raw)
  To: Christopher Schmidt; +Cc: emacs-devel

On Mon, 25 Feb 2013 23:01:08 +0000 (GMT)
Christopher Schmidt <christopher@ch.ristopher.com> wrote:

> Xue Fuqiao <xfq.free@gmail.com> writes:
> > If this would make the first line too long, maybe we can use a Local
> > Variables section at the end of the file.
> That is not a good idea.  Check bug 12049.

I see, thanks for your explanation.  And in (info "(elisp) Library Headers"):

  The very first line should have this format:
     ;;; FILENAME --- DESCRIPTION
  The description should be contained in one line.  If the file needs a
  `-*-' specification, put it after DESCRIPTION.  If this would make the
  first line too long, use a Local Variables section at the end of the
  file.

Should this be changed?

>         Christopher

-- 
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao



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

* Re: CheckDoc and package.el versus file variable prop lines
  2013-02-25 19:37 ` Glenn Morris
@ 2013-02-26 13:48   ` Sebastian Wiesner
  0 siblings, 0 replies; 9+ messages in thread
From: Sebastian Wiesner @ 2013-02-26 13:48 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

2013/2/25 Glenn Morris <rgm@gnu.org>:
> Sebastian Wiesner wrote:
>
>> How can I get lexical scoping working for a package, *without* it
>> being silently dropped on installation, and *without* checkdoc
>> warnings?
>
> Why not do what existing packages do?
>
> ;;; pcmpl-ack.el --- completion for ack tool  -*- lexical-binding: t; -*-

Easy, I simply didn't think of doing it this way.  You may call me stupid now…

Yet, the question remains why "add-file-local-variable-prop-line"
doesn't get this right.



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

* Re: CheckDoc and package.el versus file variable prop lines
  2013-02-25 20:13 ` Stefan Monnier
  2013-02-25 22:53   ` Xue Fuqiao
@ 2013-02-26 13:52   ` Sebastian Wiesner
  1 sibling, 0 replies; 9+ messages in thread
From: Sebastian Wiesner @ 2013-02-26 13:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

2013/2/25 Stefan Monnier <monnier@iro.umontreal.ca>:
>> Doing so, I get a "foo.el" with the following contents:
>
>> ;; -*- lexical-binding: t; -*-
>> ;;; foo.el --- Random stuff
>
> Please report this via M-x report-emacs-bug (so we get a bug-number for it).

If I understand you aright, the bug is not in the conflicting
requirements for the first line, but simply in that
"add-file-local-variable-prop-line" inserts a new line at the
beginning of the file instead of appending to the package header line?

>> How can I get lexical scoping working for a package, *without* it
>> being silently dropped on installation, and *without* checkdoc
>> warnings?
>
> Use
>
>   ;;; foo.el --- Random stuff  -*- lexical-binding: t -*-
>
> It's a bit ugly, especially because it tends to go past the 80-column
> limit, but that's the "standard" way to do it (and that's what
> add-file-local-variable-prop-line should use in Elisp).

Why can't Emacs treat the package header like it treats shebangs, i.e.
skip them when searching for the local variable prop line?  I mean, in
a Python script the following works:

#!/bin/sh
# -*- coding: utf-8 -*-

So can't the following be made to work for Emacs Lisp?

;;; foo.el --- Random stuff
;; -*- lexical-binding: t -*-

This is way prettier…



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

end of thread, other threads:[~2013-02-26 13:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-25 16:48 CheckDoc and package.el versus file variable prop lines Sebastian Wiesner
2013-02-25 19:37 ` Glenn Morris
2013-02-26 13:48   ` Sebastian Wiesner
2013-02-25 20:13 ` Stefan Monnier
2013-02-25 22:53   ` Xue Fuqiao
2013-02-25 23:01     ` Christopher Schmidt
2013-02-26 10:39       ` Xue Fuqiao
2013-02-26  0:00     ` Stefan Monnier
2013-02-26 13:52   ` Sebastian Wiesner

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