unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Lexical binding at top of file
@ 2024-07-06 22:56 Heime
  2024-07-07  3:13 ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 6+ messages in thread
From: Heime @ 2024-07-06 22:56 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

To enable lexical binding in an elisp library, a line is put at the top of the file:

;; -*- lexical-binding: t -*-

Would the following also be good (three ;;; and the file name) ?  

;;; file.el -*- lexical-binding: t -*-

Any idea when it would it be possible not to need the declaration, as lexical binding
for library files would be implicit ?.





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

* Re: Lexical binding at top of file
  2024-07-06 22:56 Lexical binding at top of file Heime
@ 2024-07-07  3:13 ` Stefan Monnier via Users list for the GNU Emacs text editor
  2024-07-07 13:31   ` Heime
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-07-07  3:13 UTC (permalink / raw)
  To: help-gnu-emacs

> ;;; file.el -*- lexical-binding: t -*-
> Any idea when it would it be possible not to need the declaration,

Current best guess: Emacs-32 or Emacs-31?


        Stefan




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

* Re: Lexical binding at top of file
  2024-07-07  3:13 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2024-07-07 13:31   ` Heime
  2024-07-07 14:20     ` CToID
  0 siblings, 1 reply; 6+ messages in thread
From: Heime @ 2024-07-07 13:31 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs


On Sunday, July 7th, 2024 at 3:13 AM, Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> > ;;; file.el -- lexical-binding: t --
> > Any idea when it would it be possible not to need the declaration,
> 
> Current best guess: Emacs-32 or Emacs-31?
> 
> Stefan

Does the lexical-binding: t apply when there is an arbitrary number of
comment characters ? 

;;; file.el -*- lexical-binding: t -*-



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

* Re: Lexical binding at top of file
  2024-07-07 13:31   ` Heime
@ 2024-07-07 14:20     ` CToID
  2024-07-07 15:39       ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 6+ messages in thread
From: CToID @ 2024-07-07 14:20 UTC (permalink / raw)
  To: Heime; +Cc: help-gnu-emacs

On 2024-07-07 Sun 21:31 UTC+0800, Heime <heimeborgia@protonmail.com> said:

> Does the lexical-binding: t apply when there is an arbitrary number of
> comment characters ?
> 
> ;;; file.el -*- lexical-binding: t -*-
> 

This is the first line from `git-rebase.el` from magit.

;;; git-rebase.el --- Edit Git rebase files  -*- lexical-binding:t -*-

So one can probably have some characters in front of the actually var 
list.  Not sure if it's arbitrary tho.

-- 
Best,
ID




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

* Re: Lexical binding at top of file
  2024-07-07 14:20     ` CToID
@ 2024-07-07 15:39       ` Stefan Monnier via Users list for the GNU Emacs text editor
  2024-07-07 16:08         ` CToID
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-07-07 15:39 UTC (permalink / raw)
  To: help-gnu-emacs

> This is the first line from `git-rebase.el` from magit.
>
> ;;; git-rebase.el --- Edit Git rebase files  -*- lexical-binding:t -*-
>
> So one can probably have some characters in front of the actually var list.
> Not sure if it's arbitrary tho.

If it's not clearly documented in the ELisp manual (or you find it too
difficult to find), please report it as a bug.


        Stefan




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

* Re: Lexical binding at top of file
  2024-07-07 15:39       ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2024-07-07 16:08         ` CToID
  0 siblings, 0 replies; 6+ messages in thread
From: CToID @ 2024-07-07 16:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

On 2024-07-07 Sun 23:39 UTC+0800, Stefan Monnier via Users list for the 
GNU Emacs text editor <help-gnu-emacs@gnu.org> said:

> If it's not clearly documented in the ELisp manual (or you find it too
> difficult to find), please report it as a bug.

I don't see it mentioned anywhere in both Emacs and Elisp manual.  In 
Emacs manual, it only mentions that it can be placed on the second line 
of a shell script.  Elisp manual doesn't even mention how it should look 
like.

-- 
Best,
ID




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

end of thread, other threads:[~2024-07-07 16:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-06 22:56 Lexical binding at top of file Heime
2024-07-07  3:13 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-07-07 13:31   ` Heime
2024-07-07 14:20     ` CToID
2024-07-07 15:39       ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-07-07 16:08         ` CToID

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