diff options
| author | Richard M. Stallman | 2006-05-29 00:18:44 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-05-29 00:18:44 +0000 |
| commit | 688e9e8cf999f24a7cfbe3dac0908093a37b290e (patch) | |
| tree | 778181c7f79e3c979d4fb53800e52c16fb9a705c | |
| parent | b35444d58bc3e75d79bf34bef9145a6dd4c5d84d (diff) | |
| download | emacs-688e9e8cf999f24a7cfbe3dac0908093a37b290e.tar.gz emacs-688e9e8cf999f24a7cfbe3dac0908093a37b290e.zip | |
(Coding Conventions): Better explain reasons not to
advise other packages or use `eval-after-load'.
| -rw-r--r-- | lispref/tips.texi | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lispref/tips.texi b/lispref/tips.texi index 8447a779ea0..d2060a942bf 100644 --- a/lispref/tips.texi +++ b/lispref/tips.texi | |||
| @@ -174,19 +174,28 @@ compatibility issues. | |||
| 174 | @end example | 174 | @end example |
| 175 | 175 | ||
| 176 | @item | 176 | @item |
| 177 | Redefining (or advising) an Emacs primitive is discouraged. It may do | 177 | Redefining (or advising) an Emacs primitive is a bad idea. It may do |
| 178 | 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 |
| 179 | other programs might break as a result. In any case, it is a | 179 | other programs might break as a result. In any case, it is a problem |
| 180 | maintenance burden because the two packages become highly dependent on | 180 | for debugging, because the two advised function doesn't do what its |
| 181 | each other. | 181 | source code says it does. If the programmer investigating the problem |
| 182 | is unaware that there is advice on the function, the experience can be | ||
| 183 | very frustrating. | ||
| 184 | |||
| 185 | We hope to remove all the places in Emacs that advise primitives. | ||
| 186 | In the mean time, please don't add any more. | ||
| 187 | |||
| 188 | @item | ||
| 189 | It is likewise a bad idea for one Lisp package to advise a function | ||
| 190 | in another Lisp package. | ||
| 182 | 191 | ||
| 183 | @item | 192 | @item |
| 184 | Likewise, avoid using @code{eval-after-load} (@pxref{Hooks for | 193 | Likewise, avoid using @code{eval-after-load} (@pxref{Hooks for |
| 185 | Loading}) in libraries and packages. This feature is meant for | 194 | Loading}) in libraries and packages. This feature is meant for |
| 186 | personal customizations; using it in a Lisp package increases the | 195 | personal customizations; using it in a Lisp program is unclean because |
| 187 | coupling between it and the package mentioned in | 196 | it modifies the behavior of another Lisp file in an invisible way. |
| 188 | @code{eval-after-load}, and thus makes it harder to maintain the two | 197 | This is an obstacle for debugging, much like advising a function in |
| 189 | packages independently. | 198 | the other package. |
| 190 | 199 | ||
| 191 | @item | 200 | @item |
| 192 | If a file does replace any of the functions or library programs of | 201 | If a file does replace any of the functions or library programs of |