Mercurial > emacs
changeset 60273:a0cca815ceaa
(Coding Conventions): Clarify.
Put all the major mode key reservations together.
Mention the Mouse-1 => Mouse-2 conventions.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 27 Feb 2005 00:14:20 +0000 |
parents | 881cc84dd099 |
children | 1efc3a7ce718 |
files | lispref/tips.texi |
diffstat | 1 files changed, 21 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/lispref/tips.texi Sun Feb 27 00:12:33 2005 +0000 +++ b/lispref/tips.texi Sun Feb 27 00:14:20 2005 +0000 @@ -46,7 +46,7 @@ prefix. This helps avoid name conflicts. This recommendation applies even to names for traditional Lisp -primitives that are not primitives in Emacs Lisp---even to +primitives that are not primitives in Emacs Lisp---such as @code{copy-list}. Believe it or not, there is more than one plausible way to define @code{copy-list}. Play it safe; append your name prefix to produce a name like @code{foo-copy-list} or @code{mylib-copy-list} @@ -101,11 +101,7 @@ that could cause name clashes for users who don't use that package. However, there is no problem with using the @code{cl} package at compile -time, for the sake of macros. You do that like this: - -@example -(eval-when-compile (require 'cl)) -@end example +time, with @code{(eval-when-compile (require 'cl))}. @item When defining a major mode, please follow the major mode @@ -134,16 +130,26 @@ @item @cindex reserved keys @cindex keys, reserved -Please do not define @kbd{C-c @var{letter}} as a key in your major -modes. Sequences consisting of @kbd{C-c} and a letter (either upper -or lower case) are reserved for users; they are the @strong{only} -sequences reserved for users, so do not block them. +Please do not define @kbd{C-c @var{letter}} as a key in Lisp programs. +Sequences consisting of @kbd{C-c} and a letter (either upper or lower +case) are reserved for users; they are the @strong{only} sequences +reserved for users, so do not block them. Changing all the Emacs major modes to respect this convention was a lot of work; abandoning this convention would make that work go to waste, and inconvenience users. Please comply with it. @item +Function keys @key{F5} through @key{F9} without modifier keys are +also reserved for users to define. + +@item +Applications should not bind mouse events based on button 1 with the +shift key held down. These events include @kbd{S-mouse-1}, +@kbd{M-S-mouse-1}, @kbd{C-S-mouse-1}, and so on. They are reserved for +users. + +@item Sequences consisting of @kbd{C-c} followed by a control character or a digit are reserved for major modes. @@ -158,10 +164,6 @@ may be shadowed from time to time by minor modes. @item -Function keys @key{F5} through @key{F9} without modifier keys are -reserved for users to define. - -@item Do not bind @kbd{C-h} following any prefix character (including @kbd{C-c}). If you don't bind @kbd{C-h}, it is automatically available as a help character for listing the subcommands of the prefix character. @@ -189,12 +191,6 @@ @kbd{@key{ESC} @key{ESC}} instead. @item -Applications should not bind mouse events based on button 1 with the -shift key held down. These events include @kbd{S-mouse-1}, -@kbd{M-S-mouse-1}, @kbd{C-S-mouse-1}, and so on. They are reserved for -users. - -@item @cindex mouse-2 @cindex references, following Special major modes used for read-only text should usually redefine @@ -202,6 +198,9 @@ Modes such as Dired, Info, Compilation, and Occur redefine it in this way. +In addition, they should mark the text as a kind of ``link'' so that +@kbd{mouse-1} will follow it also. @xref{Links and Mouse-1}. + @item When a package provides a modification of ordinary Emacs behavior, it is good to include a command to enable and disable the feature, provide a @@ -382,8 +381,7 @@ @item If you use many functions and variables from a certain file, you can add a @code{require} for that package to avoid compilation warnings -for them. It is better if the @code{require} acts only at compile -time. Here's how to do this: +for them. For instance, @example (eval-when-compile @@ -434,7 +432,7 @@ If you have signed papers to assign the copyright to the Foundation, then use @samp{Free Software Foundation, Inc.} as @var{name}. -Otherwise, use your name. +Otherwise, use your name. See also @xref{Library Headers}. @end itemize @node Compilation Tips