aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-02-02 15:44:19 -0500
committerChong Yidong2011-02-02 15:44:19 -0500
commite0dd683709b3f6fc954db4e3c9b59f55d202db84 (patch)
tree0155e25da6ef7db1612c4fb70a6a0366e351add5
parent83cc5772916e984fbf5d4e9f6db878c90d9189c7 (diff)
downloademacs-e0dd683709b3f6fc954db4e3c9b59f55d202db84.tar.gz
emacs-e0dd683709b3f6fc954db4e3c9b59f55d202db84.zip
* modes.texi (Major Mode Conventions): Add face guidelines.
(Faces for Font Lock): List faces in order of prominence.
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/modes.texi123
2 files changed, 82 insertions, 46 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index a3a89219bff..e7ccc34494d 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12011-02-02 Chong Yidong <cyd@stupidchicken.com>
2
3 * modes.texi (Major Mode Conventions): Add face guidelines.
4 (Faces for Font Lock): List faces in order of prominence.
5
12011-02-01 Paul Eggert <eggert@cs.ucla.edu> 62011-02-01 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 format-time-string now supports subsecond time stamp resolution 8 format-time-string now supports subsecond time stamp resolution
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 7cf319bc6c9..f238f38462f 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -415,6 +415,31 @@ setting up a buffer-local value for the variable
415@code{font-lock-defaults} (@pxref{Font Lock Mode}). 415@code{font-lock-defaults} (@pxref{Font Lock Mode}).
416 416
417@item 417@item
418Each face that the mode defines should, if possible, inherit from an
419existing Emacs face. This reduces the chance of conflicting with a
420user's face customizations. Useful faces include:
421
422@table @asis
423@item @code{highlight}
424for stretches of text that should temporarily stand out.
425
426@item @code{match}
427for text matching a search command.
428
429@item @code{link} and @code{link-visited}
430for clickable text buttons that send the user to a different buffer or
431``location''.
432
433@item @code{button}
434for clickable text buttons that perform other actions.
435
436@item @asis{Font Lock faces}
437for other kinds of syntactic highlighting, if highlighting is not
438handled by Font Lock mode or some Font Lock faces are not in use.
439@xref{Faces for Font Lock}, for how to assign Font Lock faces.
440@end table
441
442@item
418The mode should specify how Imenu should find the definitions or 443The mode should specify how Imenu should find the definitions or
419sections of a buffer, by setting up a buffer-local value for the 444sections of a buffer, by setting up a buffer-local value for the
420variable @code{imenu-generic-expression}, for the two variables 445variable @code{imenu-generic-expression}, for the two variables
@@ -2879,73 +2904,79 @@ the normal Font Lock machinery, it should not set the variable
2879@cindex faces for font lock 2904@cindex faces for font lock
2880@cindex font lock faces 2905@cindex font lock faces
2881 2906
2882 You can make Font Lock mode use any face, but several faces are 2907 Font Lock mode can highlight using any face, but Emacs defines several
2883defined specifically for Font Lock mode. Each of these symbols is both 2908faces specifically for syntactic highlighting. These @dfn{Font Lock
2884a face name, and a variable whose default value is the symbol itself. 2909faces} are listed below. They can also be used by major modes for
2885Thus, the default value of @code{font-lock-comment-face} is 2910syntactic highlighting outside of Font Lock mode (@pxref{Major Mode
2886@code{font-lock-comment-face}. This means you can write 2911Conventions}).
2887@code{font-lock-comment-face} in a context such as
2888@code{font-lock-keywords} where a face-name-valued expression is used.
2889
2890@table @code
2891@item font-lock-comment-face
2892@vindex font-lock-comment-face
2893Used (typically) for comments.
2894
2895@item font-lock-comment-delimiter-face
2896@vindex font-lock-comment-delimiter-face
2897Used (typically) for comments delimiters.
2898
2899@item font-lock-doc-face
2900@vindex font-lock-doc-face
2901Used (typically) for documentation strings in the code.
2902 2912
2903@item font-lock-string-face 2913 Each of these symbols is both a face name, and a variable whose
2904@vindex font-lock-string-face 2914default value is the symbol itself. Thus, the default value of
2905Used (typically) for string constants. 2915@code{font-lock-comment-face} is @code{font-lock-comment-face}.
2906 2916
2907@item font-lock-keyword-face 2917 The faces are listed with descriptions of their typical usage, and in
2908@vindex font-lock-keyword-face 2918order of greater to lesser ``prominence''. If a mode's syntactic
2909Used (typically) for keywords---names that have special syntactic 2919categories do not fit well with the usage descriptions, the faces can be
2910significance, like @code{for} and @code{if} in C. 2920assigned using the ordering as a guide.
2911 2921
2912@item font-lock-builtin-face 2922@table @code
2913@vindex font-lock-builtin-face 2923@item font-lock-warning-face
2914Used (typically) for built-in function names. 2924@vindex font-lock-warning-face
2925for a construct that is peculiar, or that greatly changes the meaning of
2926other text, like @samp{;;;###autoload} in Emacs Lisp and @samp{#error}
2927in C.
2915 2928
2916@item font-lock-function-name-face 2929@item font-lock-function-name-face
2917@vindex font-lock-function-name-face 2930@vindex font-lock-function-name-face
2918Used (typically) for the name of a function being defined or declared, 2931for the name of a function being defined or declared.
2919in a function definition or declaration.
2920 2932
2921@item font-lock-variable-name-face 2933@item font-lock-variable-name-face
2922@vindex font-lock-variable-name-face 2934@vindex font-lock-variable-name-face
2923Used (typically) for the name of a variable being defined or declared, 2935for the name of a variable being defined or declared.
2924in a variable definition or declaration. 2936
2937@item font-lock-keyword-face
2938@vindex font-lock-keyword-face
2939for a keyword with special syntactic significance, like @samp{for} and
2940@samp{if} in C.
2941
2942@item font-lock-comment-face
2943@vindex font-lock-comment-face
2944for comments.
2945
2946@item font-lock-comment-delimiter-face
2947@vindex font-lock-comment-delimiter-face
2948for comments delimiters, like @samp{/*} and @samp{*/} in C. On most
2949terminals, this inherits from @code{font-lock-comment-face}.
2925 2950
2926@item font-lock-type-face 2951@item font-lock-type-face
2927@vindex font-lock-type-face 2952@vindex font-lock-type-face
2928Used (typically) for names of user-defined data types, 2953for the names of user-defined data types.
2929where they are defined and where they are used.
2930 2954
2931@item font-lock-constant-face 2955@item font-lock-constant-face
2932@vindex font-lock-constant-face 2956@vindex font-lock-constant-face
2933Used (typically) for constant names. 2957for the names of constants, like @samp{NULL} in C.
2958
2959@item font-lock-builtin-face
2960@vindex font-lock-builtin-face
2961for the names of built-in functions.
2934 2962
2935@item font-lock-preprocessor-face 2963@item font-lock-preprocessor-face
2936@vindex font-lock-preprocessor-face 2964@vindex font-lock-preprocessor-face
2937Used (typically) for preprocessor commands. 2965for preprocessor commands. This inherits, by default, from
2966@code{font-lock-builtin-face}.
2967
2968@item font-lock-string-face
2969@vindex font-lock-string-face
2970for string constants.
2971
2972@item font-lock-doc-face
2973@vindex font-lock-doc-face
2974for documentation strings in the code. This inherits, by default, from
2975@code{font-lock-string-face}.
2938 2976
2939@item font-lock-negation-char-face 2977@item font-lock-negation-char-face
2940@vindex font-lock-negation-char-face 2978@vindex font-lock-negation-char-face
2941Used (typically) for easily-overlooked negation characters. 2979for easily-overlooked negation characters.
2942
2943@item font-lock-warning-face
2944@vindex font-lock-warning-face
2945Used (typically) for constructs that are peculiar, or that greatly
2946change the meaning of other text. For example, this is used for
2947@samp{;;;###autoload} cookies in Emacs Lisp, and for @code{#error}
2948directives in C.
2949@end table 2980@end table
2950 2981
2951@node Syntactic Font Lock 2982@node Syntactic Font Lock