diff options
| author | Chong Yidong | 2011-02-02 15:44:19 -0500 |
|---|---|---|
| committer | Chong Yidong | 2011-02-02 15:44:19 -0500 |
| commit | e0dd683709b3f6fc954db4e3c9b59f55d202db84 (patch) | |
| tree | 0155e25da6ef7db1612c4fb70a6a0366e351add5 /doc | |
| parent | 83cc5772916e984fbf5d4e9f6db878c90d9189c7 (diff) | |
| download | emacs-e0dd683709b3f6fc954db4e3c9b59f55d202db84.tar.gz emacs-e0dd683709b3f6fc954db4e3c9b59f55d202db84.zip | |
* modes.texi (Major Mode Conventions): Add face guidelines.
(Faces for Font Lock): List faces in order of prominence.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/modes.texi | 123 |
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 @@ | |||
| 1 | 2011-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 | |||
| 1 | 2011-02-01 Paul Eggert <eggert@cs.ucla.edu> | 6 | 2011-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 |
| 418 | Each face that the mode defines should, if possible, inherit from an | ||
| 419 | existing Emacs face. This reduces the chance of conflicting with a | ||
| 420 | user's face customizations. Useful faces include: | ||
| 421 | |||
| 422 | @table @asis | ||
| 423 | @item @code{highlight} | ||
| 424 | for stretches of text that should temporarily stand out. | ||
| 425 | |||
| 426 | @item @code{match} | ||
| 427 | for text matching a search command. | ||
| 428 | |||
| 429 | @item @code{link} and @code{link-visited} | ||
| 430 | for clickable text buttons that send the user to a different buffer or | ||
| 431 | ``location''. | ||
| 432 | |||
| 433 | @item @code{button} | ||
| 434 | for clickable text buttons that perform other actions. | ||
| 435 | |||
| 436 | @item @asis{Font Lock faces} | ||
| 437 | for other kinds of syntactic highlighting, if highlighting is not | ||
| 438 | handled 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 | ||
| 418 | The mode should specify how Imenu should find the definitions or | 443 | The mode should specify how Imenu should find the definitions or |
| 419 | sections of a buffer, by setting up a buffer-local value for the | 444 | sections of a buffer, by setting up a buffer-local value for the |
| 420 | variable @code{imenu-generic-expression}, for the two variables | 445 | variable @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 |
| 2883 | defined specifically for Font Lock mode. Each of these symbols is both | 2908 | faces specifically for syntactic highlighting. These @dfn{Font Lock |
| 2884 | a face name, and a variable whose default value is the symbol itself. | 2909 | faces} are listed below. They can also be used by major modes for |
| 2885 | Thus, the default value of @code{font-lock-comment-face} is | 2910 | syntactic highlighting outside of Font Lock mode (@pxref{Major Mode |
| 2886 | @code{font-lock-comment-face}. This means you can write | 2911 | Conventions}). |
| 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 | ||
| 2893 | Used (typically) for comments. | ||
| 2894 | |||
| 2895 | @item font-lock-comment-delimiter-face | ||
| 2896 | @vindex font-lock-comment-delimiter-face | ||
| 2897 | Used (typically) for comments delimiters. | ||
| 2898 | |||
| 2899 | @item font-lock-doc-face | ||
| 2900 | @vindex font-lock-doc-face | ||
| 2901 | Used (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 | 2914 | default value is the symbol itself. Thus, the default value of |
| 2905 | Used (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 | 2918 | order of greater to lesser ``prominence''. If a mode's syntactic |
| 2909 | Used (typically) for keywords---names that have special syntactic | 2919 | categories do not fit well with the usage descriptions, the faces can be |
| 2910 | significance, like @code{for} and @code{if} in C. | 2920 | assigned 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 |
| 2914 | Used (typically) for built-in function names. | 2924 | @vindex font-lock-warning-face |
| 2925 | for a construct that is peculiar, or that greatly changes the meaning of | ||
| 2926 | other text, like @samp{;;;###autoload} in Emacs Lisp and @samp{#error} | ||
| 2927 | in 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 |
| 2918 | Used (typically) for the name of a function being defined or declared, | 2931 | for the name of a function being defined or declared. |
| 2919 | in 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 |
| 2923 | Used (typically) for the name of a variable being defined or declared, | 2935 | for the name of a variable being defined or declared. |
| 2924 | in a variable definition or declaration. | 2936 | |
| 2937 | @item font-lock-keyword-face | ||
| 2938 | @vindex font-lock-keyword-face | ||
| 2939 | for 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 | ||
| 2944 | for comments. | ||
| 2945 | |||
| 2946 | @item font-lock-comment-delimiter-face | ||
| 2947 | @vindex font-lock-comment-delimiter-face | ||
| 2948 | for comments delimiters, like @samp{/*} and @samp{*/} in C. On most | ||
| 2949 | terminals, 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 |
| 2928 | Used (typically) for names of user-defined data types, | 2953 | for the names of user-defined data types. |
| 2929 | where 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 |
| 2933 | Used (typically) for constant names. | 2957 | for the names of constants, like @samp{NULL} in C. |
| 2958 | |||
| 2959 | @item font-lock-builtin-face | ||
| 2960 | @vindex font-lock-builtin-face | ||
| 2961 | for 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 |
| 2937 | Used (typically) for preprocessor commands. | 2965 | for 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 | ||
| 2970 | for string constants. | ||
| 2971 | |||
| 2972 | @item font-lock-doc-face | ||
| 2973 | @vindex font-lock-doc-face | ||
| 2974 | for 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 |
| 2941 | Used (typically) for easily-overlooked negation characters. | 2979 | for easily-overlooked negation characters. |
| 2942 | |||
| 2943 | @item font-lock-warning-face | ||
| 2944 | @vindex font-lock-warning-face | ||
| 2945 | Used (typically) for constructs that are peculiar, or that greatly | ||
| 2946 | change the meaning of other text. For example, this is used for | ||
| 2947 | @samp{;;;###autoload} cookies in Emacs Lisp, and for @code{#error} | ||
| 2948 | directives in C. | ||
| 2949 | @end table | 2980 | @end table |
| 2950 | 2981 | ||
| 2951 | @node Syntactic Font Lock | 2982 | @node Syntactic Font Lock |