aboutsummaryrefslogtreecommitdiffstats
path: root/lispref
diff options
context:
space:
mode:
authorMiles Bader2006-05-02 05:51:52 +0000
committerMiles Bader2006-05-02 05:51:52 +0000
commitfe682fb2f05fcbd9fcd2d12c2110719adcfcb58a (patch)
tree2a89d2d9ea2689cfe80a7618885cdd9f449761dd /lispref
parent7e635d0ed3c42e6e779821f5c0c1c62289f4c1ee (diff)
parent6cf93749317c2e18f850cd0f47f905895e850bfc (diff)
downloademacs-fe682fb2f05fcbd9fcd2d12c2110719adcfcb58a.tar.gz
emacs-fe682fb2f05fcbd9fcd2d12c2110719adcfcb58a.zip
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-58
Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 239-258) - Update from CVS - (Ffield_beginning, find_field): Undo change of 2006-04-23. - Rcirc patch from Ryan Yeske - Merge from gnus--rel--5.10 - Clean up lisp/gnus/ChangeLog a bit * gnus--rel--5.10 (patch 91-98) - Merge from emacs--devo--0 - Update from CVS
Diffstat (limited to 'lispref')
-rw-r--r--lispref/ChangeLog40
-rw-r--r--lispref/intro.texi13
-rw-r--r--lispref/modes.texi188
-rw-r--r--lispref/objects.texi6
-rw-r--r--lispref/syntax.texi4
-rw-r--r--lispref/variables.texi14
6 files changed, 206 insertions, 59 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index 48205488ef8..020e667ec16 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,35 @@
12006-05-01 Richard Stallman <rms@gnu.org>
2
3 * intro.texi (nil and t): Clarify.
4
5 * variables.texi (File Local Variables): Suggest using booleanp.
6
72006-05-01 Juanma Barranquero <lekktu@gmail.com>
8
9 * objects.texi (Type Predicates): Fix typos.
10
112006-05-01 Stefan Monnier <monnier@iro.umontreal.ca>
12
13 * intro.texi (nil and t): Add booleanp.
14
15 * objects.texi (Type Predicates): Add links for booleanp and
16 string-or-null-p.
17
182006-04-29 Richard Stallman <rms@gnu.org>
19
20 * modes.texi (Multiline Font Lock): Rename from
21 Multi line Font Lock Elements. Much clarification.
22 (Font Lock Multiline, Region to Fontify): Much clarification.
23
242006-04-29 Stefan Monnier <monnier@iro.umontreal.ca>
25
26 * variables.texi (File Local Variables): Remove the special case t for
27 safe-local-variable.
28
292006-04-26 Richard Stallman <rms@gnu.org>
30
31 * syntax.texi (Parsing Expressions): Minor cleanup.
32
12006-04-18 Richard Stallman <rms@gnu.org> 332006-04-18 Richard Stallman <rms@gnu.org>
2 34
3 * tips.texi (Coding Conventions): Explain when the package's 35 * tips.texi (Coding Conventions): Explain when the package's
@@ -60,7 +92,7 @@
60 92
612006-03-25 Karl Berry <karl@gnu.org> 932006-03-25 Karl Berry <karl@gnu.org>
62 94
63 * elisp.texi: use @copyright{} instead of (C), and do not indent 95 * elisp.texi: Use @copyright{} instead of (C), and do not indent
64 the year list. 96 the year list.
65 97
662006-03-21 Nick Roberts <nickrob@snap.net.nz> 982006-03-21 Nick Roberts <nickrob@snap.net.nz>
@@ -94,7 +126,7 @@
94 126
95 * display.texi (Defining Images): Fix example in 127 * display.texi (Defining Images): Fix example in
96 image-load-path-for-library by not recommending that one binds 128 image-load-path-for-library by not recommending that one binds
97 image-load-path. Just defvar it to placate compiler and only use 129 image-load-path. Just defvar it to placate compiler and only use
98 it if previously defined. 130 it if previously defined.
99 131
1002006-03-14 Bill Wohler <wohler@newt.com> 1322006-03-14 Bill Wohler <wohler@newt.com>
@@ -566,11 +598,11 @@
566 598
5672005-09-26 Chong Yidong <cyd@stupidchicken.com> 5992005-09-26 Chong Yidong <cyd@stupidchicken.com>
568 600
569 * errors.texi (Standard Errors): Corrected xrefs. 601 * errors.texi (Standard Errors): Correct xrefs.
570 602
5712005-09-18 Chong Yidong <cyd@stupidchicken.com> 6032005-09-18 Chong Yidong <cyd@stupidchicken.com>
572 604
573 * display.texi (Defining Images): Updated documentation for 605 * display.texi (Defining Images): Update documentation for
574 `image-load-path'. 606 `image-load-path'.
575 607
5762005-09-17 Richard M. Stallman <rms@gnu.org> 6082005-09-17 Richard M. Stallman <rms@gnu.org>
diff --git a/lispref/intro.texi b/lispref/intro.texi
index b2294be4c2d..7e1b6155b35 100644
--- a/lispref/intro.texi
+++ b/lispref/intro.texi
@@ -163,7 +163,7 @@ person reading this manual, are thought of as ``the programmer'' and are
163addressed as ``you''. ``The user'' is the person who uses Lisp 163addressed as ``you''. ``The user'' is the person who uses Lisp
164programs, including those you write. 164programs, including those you write.
165 165
166@cindex fonts 166@cindex fonts in this manual
167 Examples of Lisp code are formatted like this: @code{(list 1 2 3)}. 167 Examples of Lisp code are formatted like this: @code{(list 1 2 3)}.
168Names that represent metasyntactic variables, or arguments to a function 168Names that represent metasyntactic variables, or arguments to a function
169being described, are formatted like this: @var{first-number}. 169being described, are formatted like this: @var{first-number}.
@@ -187,14 +187,14 @@ readers. After the Lisp reader has read either @samp{()} or @samp{nil},
187there is no way to determine which representation was actually written 187there is no way to determine which representation was actually written
188by the programmer. 188by the programmer.
189 189
190 In this manual, we use @code{()} when we wish to emphasize that it 190 In this manual, we write @code{()} when we wish to emphasize that it
191means the empty list, and we use @code{nil} when we wish to emphasize 191means the empty list, and we write @code{nil} when we wish to emphasize
192that it means the truth value @var{false}. That is a good convention to use 192that it means the truth value @var{false}. That is a good convention to use
193in Lisp programs also. 193in Lisp programs also.
194 194
195@example 195@example
196(cons 'foo ()) ; @r{Emphasize the empty list} 196(cons 'foo ()) ; @r{Emphasize the empty list}
197(not nil) ; @r{Emphasize the truth value @var{false}} 197(setq foo-flag nil) ; @r{Emphasize the truth value @var{false}}
198@end example 198@end example
199 199
200@cindex @code{t}, uses of 200@cindex @code{t}, uses of
@@ -212,6 +212,11 @@ to use them as constants in a program. An attempt to change their
212values results in a @code{setting-constant} error. @xref{Constant 212values results in a @code{setting-constant} error. @xref{Constant
213Variables}. 213Variables}.
214 214
215@defun booleanp object
216Return non-nil iff @var{object} is one of the two canonical boolean
217values: @code{t} or @code{nil}.
218@end defun
219
215@node Evaluation Notation 220@node Evaluation Notation
216@subsection Evaluation Notation 221@subsection Evaluation Notation
217@cindex evaluation notation 222@cindex evaluation notation
diff --git a/lispref/modes.texi b/lispref/modes.texi
index b33424a58be..9e55ca847fc 100644
--- a/lispref/modes.texi
+++ b/lispref/modes.texi
@@ -2336,8 +2336,6 @@ Search-based fontification happens second.
2336* Font Lock Basics:: Overview of customizing Font Lock. 2336* Font Lock Basics:: Overview of customizing Font Lock.
2337* Search-based Fontification:: Fontification based on regexps. 2337* Search-based Fontification:: Fontification based on regexps.
2338* Customizing Keywords:: Customizing search-based fontification. 2338* Customizing Keywords:: Customizing search-based fontification.
2339* Region to Fontify:: Controlling which region gets refontified
2340 after a buffer change.
2341* Other Font Lock Variables:: Additional customization facilities. 2339* Other Font Lock Variables:: Additional customization facilities.
2342* Levels of Font Lock:: Each mode can define alternative levels 2340* Levels of Font Lock:: Each mode can define alternative levels
2343 so that the user can select more or less. 2341 so that the user can select more or less.
@@ -2347,6 +2345,8 @@ Search-based fontification happens second.
2347* Syntactic Font Lock:: Fontification based on syntax tables. 2345* Syntactic Font Lock:: Fontification based on syntax tables.
2348* Setting Syntax Properties:: Defining character syntax based on context 2346* Setting Syntax Properties:: Defining character syntax based on context
2349 using the Font Lock mechanism. 2347 using the Font Lock mechanism.
2348* Multiline Font Lock:: How to coerce Font Lock into properly
2349 highlighting multiline constructs.
2350@end menu 2350@end menu
2351 2351
2352@node Font Lock Basics 2352@node Font Lock Basics
@@ -2623,16 +2623,9 @@ this value of @code{font-lock-keywords} is used in a buffer.
2623Its value should have one of the forms described in this table. 2623Its value should have one of the forms described in this table.
2624@end table 2624@end table
2625 2625
2626@vindex font-lock-multiline
2627@strong{Warning:} Do not design an element of @code{font-lock-keywords} 2626@strong{Warning:} Do not design an element of @code{font-lock-keywords}
2628to match text which spans lines; this does not work reliably. While 2627to match text which spans lines; this does not work reliably.
2629@code{font-lock-fontify-buffer} handles multi-line patterns correctly, 2628For details, see @xref{Multiline Font Lock}.
2630updating when you edit the buffer does not, since it considers text one
2631line at a time. If you have patterns that typically only span one
2632line but can occasionally span two or three, such as
2633@samp{<title>...</title>}, you can ask Font Lock to be more careful by
2634setting @code{font-lock-multiline} to @code{t}. But it still will not
2635work in all cases.
2636 2629
2637You can use @var{case-fold} in @code{font-lock-defaults} to specify 2630You can use @var{case-fold} in @code{font-lock-defaults} to specify
2638the value of @code{font-lock-keywords-case-fold-search} which says 2631the value of @code{font-lock-keywords-case-fold-search} which says
@@ -2718,36 +2711,6 @@ C mode @emph{and} all modes derived from it, do this instead:
2718 font-lock-keyword-face))))) 2711 font-lock-keyword-face)))))
2719@end smallexample 2712@end smallexample
2720 2713
2721@node Region to Fontify
2722@subsection Region to Fontify after a Buffer Change
2723
2724 When a buffer is changed, the region that Font Lock refontifies is by
2725default the smallest sequence of whole lines that spans the change.
2726While this works well most of the time, sometimes it doesn't---for
2727example, when a buffer change has changed the syntactic meaning of text
2728on an earlier line.
2729
2730You can enlarge (or even reduce) the region to fontify by setting either
2731of the following variables:
2732
2733@defvar font-lock-extend-region-function
2734This buffer-local variable is either @code{nil} or is a function that
2735determines the region to fontify, which Emacs then calls after each
2736buffer change.
2737
2738The function is given three parameters, the standard @var{beg},
2739@var{end}, and @var{old-len} from after-change-functions (@pxref{Change
2740Hooks}). It should return either a cons of the beginning and end buffer
2741positions (in that order) of the region to fontify, or @code{nil} (which
2742directs the caller to fontify the default region). This function need
2743not preserve point or the match-data, but must preserve the current
2744restriction. The region it returns may start or end in the middle of a
2745line.
2746
2747Since this function is called after every buffer change, it should be
2748reasonably fast.
2749@end defvar
2750
2751@node Other Font Lock Variables 2714@node Other Font Lock Variables
2752@subsection Other Font Lock Variables 2715@subsection Other Font Lock Variables
2753 2716
@@ -2981,8 +2944,8 @@ value returns @code{font-lock-comment-face} for comments and
2981 2944
2982This can be used to highlighting different kinds of strings or 2945This can be used to highlighting different kinds of strings or
2983comments differently. It is also sometimes abused together with 2946comments differently. It is also sometimes abused together with
2984@code{font-lock-syntactic-keywords} to highlight elements that span 2947@code{font-lock-syntactic-keywords} to highlight constructs that span
2985multiple lines, but this is too obscure to document in this manual. 2948multiple lines, but this is too esoteric to document here.
2986 2949
2987Specify this variable using @var{other-vars} in 2950Specify this variable using @var{other-vars} in
2988@code{font-lock-defaults}. 2951@code{font-lock-defaults}.
@@ -3052,6 +3015,145 @@ Major modes normally set this variable with @var{other-vars} in
3052@code{font-lock-defaults}. 3015@code{font-lock-defaults}.
3053@end defvar 3016@end defvar
3054 3017
3018@node Multiline Font Lock
3019@subsection Multiline Font Lock Constructs
3020@cindex multiline font lock
3021
3022 Normally, elements of @code{font-lock-keywords} should not match
3023across multiple lines; that doesn't work reliably, because Font Lock
3024usually scans just part of the buffer, and it can miss a multi-line
3025construct that crosses the line boundary where the scan starts. (The
3026scan normally starts at the beginning of a line.)
3027
3028 Making elements that match multiline constructs work properly has
3029two aspects: correct @emph{identification} and correct
3030@emph{rehighlighting}. The first means that Font Lock finds all
3031multiline constructs. The second means that Font Lock will correctly
3032rehighlight all the relevant text when a multiline construct is
3033changed---for example, if some of the text that was previously part of
3034a multiline construct ceases to be part of it. The two aspects are
3035closely related, and often getting one of them to work will appear to
3036make the other also work. However, for reliable results you must
3037attend explicitly to both aspects.
3038
3039 There are two ways to ensure correct identification of multiline
3040constructs:
3041
3042@itemize
3043@item
3044Place a @code{font-lock-multiline} or @code{jit-lock-defer-multiline}
3045property on the construct when it is added to the buffer.
3046@item
3047Use @code{font-lock-fontify-region-function} hook to extend the scan
3048so that the scanned text never starts or ends in the middle of a
3049multiline construct.
3050@end itemize
3051
3052 There are three ways to do rehighlighting of multiline constructs:
3053
3054@itemize
3055@item
3056Place a @code{font-lock-multiline} property on the construct. This
3057will rehighlight the whole construct if any part of it is changed. In
3058some cases you can do this automatically by setting the
3059@code{font-lock-multiline} variable.
3060@item
3061Use @code{jit-lock-contextually}. This will only rehighlight the part
3062of the construct that follows the actual change, and will do it after
3063a short delay. This only works if the highlighting of the various
3064parts of your multiline construct never depends on text in subsequent
3065lines. Since @code{jit-lock-contextually} is activated by default,
3066this can be an attractive solution.
3067@item
3068Place a @code{jit-lock-defer-multiline} property on the construct.
3069This works only if @code{jit-lock-contextually} is used, but it can
3070handle the case where highlighting depends on subsequent lines.
3071@item
3072@end itemize
3073
3074@menu
3075* Font Lock Multiline:: Marking multiline chunks with a text property
3076* Region to Fontify:: Controlling which region gets refontified
3077 after a buffer change.
3078@end menu
3079
3080@node Font Lock Multiline
3081@subsubsection Font Lock Multiline
3082
3083 One way to ensure reliable rehighlighting of multiline Font Lock
3084constructs is to put on the text property @code{font-lock-multiline}.
3085It should be present and non-@code{nil} for text that is part of a
3086multiline construct.
3087
3088 When Font Lock is about to highlight a range of text, it first
3089extends the boundaries of the range as necessary so that they do not
3090fall within text marked with the @code{font-lock-multiline} property.
3091Then it removes any @code{font-lock-multiline} properties from the
3092range, and highlights it. The highlighting specification (mostly
3093@code{font-lock-keywords}) must reinstall this property each time,
3094whenever it is appropriate.
3095
3096 @strong{Warning:} don't use the @code{font-lock-multiline} property
3097on large ranges of text, because that will make rehighlighting slow.
3098
3099@defvar font-lock-multiline
3100If the @code{font-lock-multiline} variable is set to @code{t}, Font
3101Lock will try to add the @code{font-lock-multiline} property
3102automatically on multiline constructs. This is not a universal
3103solution, however, since it slows down Font Lock somewhat. It can
3104miss some multiline constructs, or make the property larger or smaller
3105than necessary.
3106
3107For elements whose @var{matcher} is a function, the function should
3108ensure that submatch 0 covers the whole relevant multiline construct,
3109even if only a small subpart will be highlighted. It is often just as
3110easy to add the @code{font-lock-multiline} property by hand.
3111@end defvar
3112
3113 The @code{font-lock-multiline} property is meant to ensure proper
3114refontification; it does not automatically identify new multiline
3115constructs. Identifying the requires that Font-Lock operate on large
3116enough chunks at a time. This will happen by accident on many cases,
3117which may give the impression that multiline constructs magically work.
3118If you set the @code{font-lock-multiline} variable non-@code{nil},
3119this impression will be even stronger, since the highlighting of those
3120constructs which are found will be properly updated from then on.
3121But that does not work reliably.
3122
3123 To find multiline constructs reliably, you must either manually
3124place the @code{font-lock-multiline} property on the text before
3125Font-Lock looks at it, or use
3126@code{font-lock-fontify-region-function}.
3127
3128@node Region to Fontify
3129@subsubsection Region to Fontify after a Buffer Change
3130
3131 When a buffer is changed, the region that Font Lock refontifies is
3132by default the smallest sequence of whole lines that spans the change.
3133While this works well most of the time, sometimes it doesn't---for
3134example, when a change alters the syntactic meaning of text on an
3135earlier line.
3136
3137 You can enlarge (or even reduce) the region to fontify by setting
3138one the following variables:
3139
3140@defvar font-lock-extend-region-function
3141This buffer-local variable is either @code{nil} or a function for
3142Font-Lock to call to determine the region to scan and fontify.
3143
3144The function is given three parameters, the standard @var{beg},
3145@var{end}, and @var{old-len} from after-change-functions
3146(@pxref{Change Hooks}). It should return either a cons of the
3147beginning and end buffer positions (in that order) of the region to
3148fontify, or @code{nil} (which means choose the region in the standard
3149way). This function needs to preserve point, the match-data, and the
3150current restriction. The region it returns may start or end in the
3151middle of a line.
3152
3153Since this function is called after every buffer change, it should be
3154reasonably fast.
3155@end defvar
3156
3055@node Desktop Save Mode 3157@node Desktop Save Mode
3056@section Desktop Save Mode 3158@section Desktop Save Mode
3057@cindex desktop save mode 3159@cindex desktop save mode
diff --git a/lispref/objects.texi b/lispref/objects.texi
index 93848cffe09..5665e5beee6 100644
--- a/lispref/objects.texi
+++ b/lispref/objects.texi
@@ -1779,6 +1779,12 @@ with references to further information.
1779 1779
1780@item windowp 1780@item windowp
1781@xref{Basic Windows, windowp}. 1781@xref{Basic Windows, windowp}.
1782
1783@item booleanp
1784@xref{nil and t, booleanp}.
1785
1786@item string-or-null-p
1787@xref{Predicates for Strings, string-or-null-p}.
1782@end table 1788@end table
1783 1789
1784 The most general way to check the type of an object is to call the 1790 The most general way to check the type of an object is to call the
diff --git a/lispref/syntax.texi b/lispref/syntax.texi
index 7297f6b9104..1575ebeb850 100644
--- a/lispref/syntax.texi
+++ b/lispref/syntax.texi
@@ -672,7 +672,9 @@ the parse:
672 672
673@enumerate 0 673@enumerate 0
674@item 674@item
675The depth in parentheses, counting from 0. 675The depth in parentheses, counting from 0. @strong{Warning:} this can
676be negative if there are more close parens than open parens between
677the start of the defun and point.
676 678
677@item 679@item
678@cindex innermost containing parentheses 680@cindex innermost containing parentheses
diff --git a/lispref/variables.texi b/lispref/variables.texi
index d97848549c0..5b4b779448e 100644
--- a/lispref/variables.texi
+++ b/lispref/variables.texi
@@ -1778,13 +1778,13 @@ measures to prevent this.
1778 1778
1779@cindex safe local variable 1779@cindex safe local variable
1780 You can specify safe values for a variable with a 1780 You can specify safe values for a variable with a
1781@code{safe-local-variable} property. If the property is @code{t}, 1781@code{safe-local-variable} property. The property has to be
1782setting that variable in a file is always considered safe, regardless 1782a function of one argument; any value is safe if the function
1783of the value used. If the property is a function of one argument, 1783returns non-@code{nil} given that value. Many commonly encountered
1784then any value is safe if the function returns non-@code{nil} given 1784file variables standardly have @code{safe-local-variable} properties,
1785that value. Many commonly encountered file variables standardly have 1785including @code{fill-column}, @code{fill-prefix}, and
1786@code{safe-local-variable} properties, including @code{fill-column}, 1786@code{indent-tabs-mode}. For boolean-valued variables that are safe,
1787@code{fill-prefix}, and @code{indent-tabs-mode}. 1787use @code{booleanp} as the property value.
1788 1788
1789@defopt safe-local-variable-values 1789@defopt safe-local-variable-values
1790This variable provides another way to mark some variable values as 1790This variable provides another way to mark some variable values as