aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c75
1 files changed, 48 insertions, 27 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 20260d5a5d8..386d9a78153 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -933,6 +933,21 @@ If VARIABLE does not have a buffer-local binding in BUFFER, the value
933is the default binding of the variable. */) 933is the default binding of the variable. */)
934 (register Lisp_Object variable, register Lisp_Object buffer) 934 (register Lisp_Object variable, register Lisp_Object buffer)
935{ 935{
936 register Lisp_Object result = buffer_local_value_1 (variable, buffer);
937
938 if (EQ (result, Qunbound))
939 xsignal1 (Qvoid_variable, variable);
940
941 return result;
942}
943
944
945/* Like Fbuffer_local_value, but return Qunbound if the variable is
946 locally unbound. */
947
948Lisp_Object
949buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer)
950{
936 register struct buffer *buf; 951 register struct buffer *buf;
937 register Lisp_Object result; 952 register Lisp_Object result;
938 struct Lisp_Symbol *sym; 953 struct Lisp_Symbol *sym;
@@ -985,10 +1000,7 @@ is the default binding of the variable. */)
985 default: abort (); 1000 default: abort ();
986 } 1001 }
987 1002
988 if (!EQ (result, Qunbound)) 1003 return result;
989 return result;
990
991 xsignal1 (Qvoid_variable, variable);
992} 1004}
993 1005
994/* Return an alist of the Lisp-level buffer-local bindings of 1006/* Return an alist of the Lisp-level buffer-local bindings of
@@ -5329,31 +5341,40 @@ the mode line appears at the bottom. */);
5329 DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format), 5341 DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format),
5330 Qnil, 5342 Qnil,
5331 doc: /* Template for displaying mode line for current buffer. 5343 doc: /* Template for displaying mode line for current buffer.
5332Each buffer has its own value of this variable. 5344
5333Value may be nil, a string, a symbol or a list or cons cell. 5345The value may be nil, a string, a symbol or a list.
5346
5334A value of nil means don't display a mode line. 5347A value of nil means don't display a mode line.
5335For a symbol, its value is used (but it is ignored if t or nil). 5348
5336 A string appearing directly as the value of a symbol is processed verbatim 5349For any symbol other than t or nil, the symbol's value is processed as
5337 in that the %-constructs below are not recognized. 5350 a mode line construct. As a special exception, if that value is a
5338 Note that unless the symbol is marked as a `risky-local-variable', all 5351 string, the string is processed verbatim, without handling any
5339 properties in any strings, as well as all :eval and :propertize forms 5352 %-constructs (see below). Also, unless the symbol has a non-nil
5340 in the value of that symbol will be ignored. 5353 `risky-local-variable' property, all properties in any strings, as
5341For a list of the form `(:eval FORM)', FORM is evaluated and the result 5354 well as all :eval and :propertize forms in the value, are ignored.
5342 is used as a mode line element. Be careful--FORM should not load any files, 5355
5343 because that can cause an infinite recursion. 5356A list whose car is a string or list is processed by processing each
5344For a list of the form `(:propertize ELT PROPS...)', ELT is displayed 5357 of the list elements recursively, as separate mode line constructs,
5345 with the specified properties PROPS applied. 5358 and concatenating the results.
5346For a list whose car is a symbol, the symbol's value is taken, 5359
5347 and if that is non-nil, the cadr of the list is processed recursively. 5360A list of the form `(:eval FORM)' is processed by evaluating FORM and
5348 Otherwise, the caddr of the list (if there is one) is processed. 5361 using the result as a mode line construct. Be careful--FORM should
5349For a list whose car is a string or list, each element is processed 5362 not load any files, because that can cause an infinite recursion.
5350 recursively and the results are effectively concatenated. 5363
5351For a list whose car is an integer, the cdr of the list is processed 5364A list of the form `(:propertize ELT PROPS...)' is processed by
5352 and padded (if the number is positive) or truncated (if negative) 5365 processing ELT as the mode line construct, and adding the text
5353 to the width specified by that number. 5366 properties PROPS to the result.
5367
5368A list whose car is a symbol is processed by examining the symbol's
5369 value, and, if that value is non-nil, processing the cadr of the list
5370 recursively; and if that value is nil, processing the caddr of the
5371 list recursively.
5372
5373A list whose car is an integer is processed by processing the cadr of
5374 the list, and padding (if the number is positive) or truncating (if
5375 negative) to the width specified by that number.
5376
5354A string is printed verbatim in the mode line except for %-constructs: 5377A string is printed verbatim in the mode line except for %-constructs:
5355 (%-constructs are allowed when the string is the entire mode-line-format
5356 or when it is found in a cons-cell or a list)
5357 %b -- print buffer name. %f -- print visited file name. 5378 %b -- print buffer name. %f -- print visited file name.
5358 %F -- print frame name. 5379 %F -- print frame name.
5359 %* -- print %, * or hyphen. %+ -- print *, % or hyphen. 5380 %* -- print %, * or hyphen. %+ -- print *, % or hyphen.