Mercurial > emacs
diff lispref/tips.texi @ 90428:a8190f7e546e
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 285-296)
- Update from CVS
- Merge from gnus--rel--5.10
- Update from CVS: admin/FOR-RELEASE: Update refcard section.
* gnus--rel--5.10 (patch 102-104)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-64
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 07 Jun 2006 18:05:10 +0000 |
parents | 72dea2ff0142 2a973dfbccc2 |
children | 138027c8c982 |
line wrap: on
line diff
--- a/lispref/tips.texi Wed Jun 07 11:41:58 2006 +0000 +++ b/lispref/tips.texi Wed Jun 07 18:05:10 2006 +0000 @@ -35,6 +35,7 @@ @node Coding Conventions @section Emacs Lisp Coding Conventions +@cindex coding conventions in Emacs Lisp Here are conventions that you should follow when writing Emacs Lisp code intended for widespread use: @@ -52,9 +53,9 @@ @item Since all global variables share the same name space, and all functions share another name space, you should choose a short word to -distinguish your program from other Lisp programs.@footnote{The +distinguish your program from other Lisp programs@footnote{The benefits of a Common Lisp-style package system are considered not to -outweigh the costs.} Then take care to begin the names of all global +outweigh the costs.}. Then take care to begin the names of all global variables, constants, and functions in your program with the chosen prefix. This helps avoid name conflicts. @@ -173,9 +174,28 @@ @end example @item -Redefining (or advising) an Emacs primitive is discouraged. It may do +Redefining (or advising) an Emacs primitive is a bad idea. It may do the right thing for a particular program, but there is no telling what -other programs might break as a result. +other programs might break as a result. In any case, it is a problem +for debugging, because the two advised function doesn't do what its +source code says it does. If the programmer investigating the problem +is unaware that there is advice on the function, the experience can be +very frustrating. + +We hope to remove all the places in Emacs that advise primitives. +In the mean time, please don't add any more. + +@item +It is likewise a bad idea for one Lisp package to advise a function +in another Lisp package. + +@item +Likewise, avoid using @code{eval-after-load} (@pxref{Hooks for +Loading}) in libraries and packages. This feature is meant for +personal customizations; using it in a Lisp program is unclean because +it modifies the behavior of another Lisp file in an invisible way. +This is an obstacle for debugging, much like advising a function in +the other package. @item If a file does replace any of the functions or library programs of