Commit 2323275b authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(Coding Conventions): Node renamed from Style Tips.

Xref the Major Mode Conventions and Minor Mode Conventions nodes.
Other smaller changes in it.
parent 4356e9eb
...@@ -4,28 +4,29 @@ ...@@ -4,28 +4,29 @@
@c See the file elisp.texi for copying conditions. @c See the file elisp.texi for copying conditions.
@setfilename ../info/tips @setfilename ../info/tips
@node Tips, GNU Emacs Internals, Calendar, Top @node Tips, GNU Emacs Internals, Calendar, Top
@appendix Tips and Standards @appendix Tips and Conventions
@cindex tips @cindex tips
@cindex standards of coding style @cindex standards of coding style
@cindex coding standards @cindex coding standards
This chapter describes no additional features of Emacs Lisp. This chapter describes no additional features of Emacs Lisp. Instead
Instead it gives advice on making effective use of the features described it gives advice on making effective use of the features described in the
in the previous chapters. previous chapters, and describes conventions Emacs Lisp programmers
should follow.
@menu @menu
* Style Tips:: Writing clean and robust programs. * Coding Conventions:: Conventions for clean and robust programs.
* Compilation Tips:: Making compiled code run fast. * Compilation Tips:: Making compiled code run fast.
* Documentation Tips:: Writing readable documentation strings. * Documentation Tips:: Writing readable documentation strings.
* Comment Tips:: Conventions for writing comments. * Comment Tips:: Conventions for writing comments.
* Library Headers:: Standard headers for library packages. * Library Headers:: Standard headers for library packages.
@end menu @end menu
@node Style Tips @node Coding Conventions
@section Writing Clean Lisp Programs @section Emacs Lisp Coding Conventions
Here are some tips for avoiding common errors in writing Lisp code Here are conventions that you should follow when writing Emacs Lisp
intended for widespread use: code intended for widespread use:
@itemize @bullet @itemize @bullet
@item @item
...@@ -84,8 +85,12 @@ Using @code{eval-when-compile} avoids loading @var{bar} when ...@@ -84,8 +85,12 @@ Using @code{eval-when-compile} avoids loading @var{bar} when
the compiled version of @var{foo} is @emph{used}. the compiled version of @var{foo} is @emph{used}.
@item @item
If you define a major mode, make sure to run a hook variable using When defining a major mode, please follow the major mode
@code{run-hooks}, just as the existing major modes do. @xref{Hooks}. conventions. @xref{Major Mode Conventions}.
@item
When defining a minor mode, please follow the minor mode
conventions. @xref{Minor Mode Conventions}.
@item @item
If the purpose of a function is to tell you whether a certain condition If the purpose of a function is to tell you whether a certain condition
...@@ -160,9 +165,9 @@ It is a bad idea to define aliases for the Emacs primitives. Use the ...@@ -160,9 +165,9 @@ It is a bad idea to define aliases for the Emacs primitives. Use the
standard names instead. standard names instead.
@item @item
Redefining an Emacs primitive is an even worse idea. Redefining (or advising) an Emacs primitive is discouraged. It may do
It may do the right thing for a particular program, but the right thing for a particular program, but there is no telling what
there is no telling what other programs might break as a result. other programs might break as a result.
@item @item
If a file does replace any of the functions or library programs of If a file does replace any of the functions or library programs of
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment