diff options
| author | Stefan Kangas | 2020-10-21 01:50:50 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2020-10-22 20:28:59 +0200 |
| commit | 8b87ea6844036c168c9ec67dd318ee3ba8dab5ae (patch) | |
| tree | 36b5b60b4ffd731762d1253511a222495b5bafc9 | |
| parent | e29cace60afdab04ff20c4f4043a3ee64ec9d01d (diff) | |
| download | emacs-8b87ea6844036c168c9ec67dd318ee3ba8dab5ae.tar.gz emacs-8b87ea6844036c168c9ec67dd318ee3ba8dab5ae.zip | |
Recommend lexical-binding in Coding Conventions
* doc/lispref/tips.texi (Coding Conventions, Library Headers):
Recommend using lexical-binding.
| -rw-r--r-- | doc/lispref/tips.texi | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index 5b09b2ccea6..4d6dcb9f834 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi | |||
| @@ -95,6 +95,11 @@ If one prefix is insufficient, your package can use two or three | |||
| 95 | alternative common prefixes, so long as they make sense. | 95 | alternative common prefixes, so long as they make sense. |
| 96 | 96 | ||
| 97 | @item | 97 | @item |
| 98 | We recommend enabling @code{lexical-binding} in new code, and | ||
| 99 | converting existing Emacs Lisp code to enable @code{lexical-binding} | ||
| 100 | if it doesn't already. @xref{Using Lexical Binding}. | ||
| 101 | |||
| 102 | @item | ||
| 98 | Put a call to @code{provide} at the end of each separate Lisp file. | 103 | Put a call to @code{provide} at the end of each separate Lisp file. |
| 99 | @xref{Named Features}. | 104 | @xref{Named Features}. |
| 100 | 105 | ||
| @@ -963,7 +968,7 @@ explains these conventions, starting with an example: | |||
| 963 | 968 | ||
| 964 | @smallexample | 969 | @smallexample |
| 965 | @group | 970 | @group |
| 966 | ;;; foo.el --- Support for the Foo programming language | 971 | ;;; foo.el --- Support for the Foo programming language -*- lexical-binding: t; -*- |
| 967 | 972 | ||
| 968 | ;; Copyright (C) 2010-2020 Your Name | 973 | ;; Copyright (C) 2010-2020 Your Name |
| 969 | @end group | 974 | @end group |
| @@ -986,14 +991,14 @@ explains these conventions, starting with an example: | |||
| 986 | The very first line should have this format: | 991 | The very first line should have this format: |
| 987 | 992 | ||
| 988 | @example | 993 | @example |
| 989 | ;;; @var{filename} --- @var{description} | 994 | ;;; @var{filename} --- @var{description} -*- lexical-binding: t; -*- |
| 990 | @end example | 995 | @end example |
| 991 | 996 | ||
| 992 | @noindent | 997 | @noindent |
| 993 | The description should be contained in one line. If the file | 998 | The description should be contained in one line. If the file needs to |
| 994 | needs a @samp{-*-} specification, put it after @var{description}. | 999 | set more variables in the @samp{-*-} specification, add it after |
| 995 | If this would make the first line too long, use a Local Variables | 1000 | @code{lexical-binding}. If this would make the first line too long, use |
| 996 | section at the end of the file. | 1001 | a Local Variables section at the end of the file. |
| 997 | 1002 | ||
| 998 | The copyright notice usually lists your name (if you wrote the | 1003 | The copyright notice usually lists your name (if you wrote the |
| 999 | file). If you have an employer who claims copyright on your work, you | 1004 | file). If you have an employer who claims copyright on your work, you |