aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2006-05-29 00:18:44 +0000
committerRichard M. Stallman2006-05-29 00:18:44 +0000
commit688e9e8cf999f24a7cfbe3dac0908093a37b290e (patch)
tree778181c7f79e3c979d4fb53800e52c16fb9a705c
parentb35444d58bc3e75d79bf34bef9145a6dd4c5d84d (diff)
downloademacs-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.texi25
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
177Redefining (or advising) an Emacs primitive is discouraged. It may do 177Redefining (or advising) an Emacs primitive is a bad idea. It may do
178the right thing for a particular program, but there is no telling what 178the right thing for a particular program, but there is no telling what
179other programs might break as a result. In any case, it is a 179other programs might break as a result. In any case, it is a problem
180maintenance burden because the two packages become highly dependent on 180for debugging, because the two advised function doesn't do what its
181each other. 181source code says it does. If the programmer investigating the problem
182is unaware that there is advice on the function, the experience can be
183very frustrating.
184
185We hope to remove all the places in Emacs that advise primitives.
186In the mean time, please don't add any more.
187
188@item
189It is likewise a bad idea for one Lisp package to advise a function
190in another Lisp package.
182 191
183@item 192@item
184Likewise, avoid using @code{eval-after-load} (@pxref{Hooks for 193Likewise, avoid using @code{eval-after-load} (@pxref{Hooks for
185Loading}) in libraries and packages. This feature is meant for 194Loading}) in libraries and packages. This feature is meant for
186personal customizations; using it in a Lisp package increases the 195personal customizations; using it in a Lisp program is unclean because
187coupling between it and the package mentioned in 196it 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 197This is an obstacle for debugging, much like advising a function in
189packages independently. 198the other package.
190 199
191@item 200@item
192If a file does replace any of the functions or library programs of 201If a file does replace any of the functions or library programs of