diff options
| author | Eli Zaretskii | 2006-05-26 19:32:02 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2006-05-26 19:32:02 +0000 |
| commit | 038783e6fc602bb2dc181561f6949389f6484a12 (patch) | |
| tree | 5967247f356b034a10145a64c109ee5778572370 | |
| parent | 0f7078f033a077cb3a0b7e287cb0d5424d60675e (diff) | |
| download | emacs-038783e6fc602bb2dc181561f6949389f6484a12.tar.gz emacs-038783e6fc602bb2dc181561f6949389f6484a12.zip | |
(Coding Conventions): Advise against using eval-after-load in packages.
Add an index entry.
| -rw-r--r-- | lispref/tips.texi | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lispref/tips.texi b/lispref/tips.texi index 889ac3e6a6d..8447a779ea0 100644 --- a/lispref/tips.texi +++ b/lispref/tips.texi | |||
| @@ -35,6 +35,7 @@ all. | |||
| 35 | @node Coding Conventions | 35 | @node Coding Conventions |
| 36 | @section Emacs Lisp Coding Conventions | 36 | @section Emacs Lisp Coding Conventions |
| 37 | 37 | ||
| 38 | @cindex coding conventions in Emacs Lisp | ||
| 38 | Here are conventions that you should follow when writing Emacs Lisp | 39 | Here are conventions that you should follow when writing Emacs Lisp |
| 39 | code intended for widespread use: | 40 | code intended for widespread use: |
| 40 | 41 | ||
| @@ -52,9 +53,9 @@ don't postpone it. | |||
| 52 | @item | 53 | @item |
| 53 | Since all global variables share the same name space, and all | 54 | Since all global variables share the same name space, and all |
| 54 | functions share another name space, you should choose a short word to | 55 | functions share another name space, you should choose a short word to |
| 55 | distinguish your program from other Lisp programs.@footnote{The | 56 | distinguish your program from other Lisp programs@footnote{The |
| 56 | benefits of a Common Lisp-style package system are considered not to | 57 | benefits of a Common Lisp-style package system are considered not to |
| 57 | outweigh the costs.} Then take care to begin the names of all global | 58 | outweigh the costs.}. Then take care to begin the names of all global |
| 58 | variables, constants, and functions in your program with the chosen | 59 | variables, constants, and functions in your program with the chosen |
| 59 | prefix. This helps avoid name conflicts. | 60 | prefix. This helps avoid name conflicts. |
| 60 | 61 | ||
| @@ -175,7 +176,17 @@ compatibility issues. | |||
| 175 | @item | 176 | @item |
| 176 | Redefining (or advising) an Emacs primitive is discouraged. It may do | 177 | Redefining (or advising) an Emacs primitive is discouraged. It may do |
| 177 | the right thing for a particular program, but there is no telling what | 178 | the right thing for a particular program, but there is no telling what |
| 178 | other programs might break as a result. | 179 | other programs might break as a result. In any case, it is a |
| 180 | maintenance burden because the two packages become highly dependent on | ||
| 181 | each other. | ||
| 182 | |||
| 183 | @item | ||
| 184 | Likewise, avoid using @code{eval-after-load} (@pxref{Hooks for | ||
| 185 | Loading}) in libraries and packages. This feature is meant for | ||
| 186 | personal customizations; using it in a Lisp package increases the | ||
| 187 | coupling between it and the package mentioned in | ||
| 188 | @code{eval-after-load}, and thus makes it harder to maintain the two | ||
| 189 | packages independently. | ||
| 179 | 190 | ||
| 180 | @item | 191 | @item |
| 181 | If a file does replace any of the functions or library programs of | 192 | If a file does replace any of the functions or library programs of |