mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-11 08:30:45 -08:00
Recommend lexical-binding in Coding Conventions
* doc/lispref/tips.texi (Coding Conventions, Library Headers): Recommend using lexical-binding.
This commit is contained in:
parent
e29cace60a
commit
8b87ea6844
1 changed files with 11 additions and 6 deletions
|
|
@ -94,6 +94,11 @@ it to Emacs. If and when we do, we can change the name easily enough.
|
||||||
If one prefix is insufficient, your package can use two or three
|
If one prefix is insufficient, your package can use two or three
|
||||||
alternative common prefixes, so long as they make sense.
|
alternative common prefixes, so long as they make sense.
|
||||||
|
|
||||||
|
@item
|
||||||
|
We recommend enabling @code{lexical-binding} in new code, and
|
||||||
|
converting existing Emacs Lisp code to enable @code{lexical-binding}
|
||||||
|
if it doesn't already. @xref{Using Lexical Binding}.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Put a call to @code{provide} at the end of each separate Lisp file.
|
Put a call to @code{provide} at the end of each separate Lisp file.
|
||||||
@xref{Named Features}.
|
@xref{Named Features}.
|
||||||
|
|
@ -963,7 +968,7 @@ explains these conventions, starting with an example:
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
@group
|
@group
|
||||||
;;; foo.el --- Support for the Foo programming language
|
;;; foo.el --- Support for the Foo programming language -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Copyright (C) 2010-2020 Your Name
|
;; Copyright (C) 2010-2020 Your Name
|
||||||
@end group
|
@end group
|
||||||
|
|
@ -986,14 +991,14 @@ explains these conventions, starting with an example:
|
||||||
The very first line should have this format:
|
The very first line should have this format:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
;;; @var{filename} --- @var{description}
|
;;; @var{filename} --- @var{description} -*- lexical-binding: t; -*-
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
The description should be contained in one line. If the file
|
The description should be contained in one line. If the file needs to
|
||||||
needs a @samp{-*-} specification, put it after @var{description}.
|
set more variables in the @samp{-*-} specification, add it after
|
||||||
If this would make the first line too long, use a Local Variables
|
@code{lexical-binding}. If this would make the first line too long, use
|
||||||
section at the end of the file.
|
a Local Variables section at the end of the file.
|
||||||
|
|
||||||
The copyright notice usually lists your name (if you wrote the
|
The copyright notice usually lists your name (if you wrote the
|
||||||
file). If you have an employer who claims copyright on your work, you
|
file). If you have an employer who claims copyright on your work, you
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue