From: Stefan Kangas <stefan@marxist.se>
To: emacs-devel@gnu.org
Subject: Recommend lexical-binding in Coding Conventions
Date: Tue, 20 Oct 2020 18:05:57 -0700 [thread overview]
Message-ID: <CADwFkmme2jZSOu6tqE=A7q0D+vM5fjP1bScoYHFD9jqJoAAydw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 255 bytes --]
We don't currently recommend using lexical-binding in our Coding
Conventions (`(elisp) Tips'). Is there some reason for that, or is it
just an oversight?
I would suggest to add it, and have attached a first draft for what it
could look like.
Thoughts?
[-- Attachment #2: 0001-Recommend-lexical-binding-in-Coding-Conventions.patch --]
[-- Type: text/x-diff, Size: 2156 bytes --]
From a2835ab38edcbd583f87998813ebf36abe110165 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Wed, 21 Oct 2020 01:50:50 +0200
Subject: [PATCH] Recommend lexical-binding in Coding Conventions
* doc/lispref/tips.texi (Coding Conventions, Library Headers):
Recommend using lexical-binding.
---
doc/lispref/tips.texi | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index 5b09b2ccea..6bed53f263 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -94,6 +94,11 @@ Coding Conventions
If one prefix is insufficient, your package can use two or three
alternative common prefixes, so long as they make sense.
+@item
+We recommended to enable @code{lexical-binding} in new code, and to
+convert existing Emacs Lisp code to use lexical binding if it doesn't
+already. @xref{Using Lexical Binding}.
+
@item
Put a call to @code{provide} at the end of each separate Lisp file.
@xref{Named Features}.
@@ -963,7 +968,7 @@ Library Headers
@smallexample
@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
@end group
@@ -986,14 +991,14 @@ Library Headers
The very first line should have this format:
@example
-;;; @var{filename} --- @var{description}
+;;; @var{filename} --- @var{description} -*- lexical-binding: t; -*-
@end example
@noindent
-The description should be contained in one line. If the file
-needs a @samp{-*-} specification, put it after @var{description}.
-If this would make the first line too long, use a Local Variables
-section at the end of the file.
+The description should be contained in one line. If the file needs to
+set more variables in the @samp{-*-} specification, add it after
+@code{lexical-binding}. If this would make the first line too long, use
+a Local Variables section at the end of the file.
The copyright notice usually lists your name (if you wrote the
file). If you have an employer who claims copyright on your work, you
--
2.28.0
next reply other threads:[~2020-10-21 1:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-21 1:05 Stefan Kangas [this message]
2020-10-21 4:32 ` Recommend lexical-binding in Coding Conventions Drew Adams
2020-10-21 13:33 ` Stefan Monnier
2020-10-21 14:52 ` Drew Adams
2020-10-21 15:14 ` Stefan Kangas
2020-10-21 15:30 ` Alan Mackenzie
2020-10-21 16:07 ` Robert Pluim
2020-10-21 16:19 ` Stefan Kangas
2020-10-21 16:38 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADwFkmme2jZSOu6tqE=A7q0D+vM5fjP1bScoYHFD9jqJoAAydw@mail.gmail.com' \
--to=stefan@marxist.se \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).