diff options
| author | Lute Kamstra | 2003-09-26 12:15:32 +0000 |
|---|---|---|
| committer | Lute Kamstra | 2003-09-26 12:15:32 +0000 |
| commit | 06862374481b6ff54af8b7c52ec804984d3d6418 (patch) | |
| tree | 0b672bc7284dab9ff7db6a8b3bce441908b02c9a /lispref | |
| parent | 6142d1d06cbc870f82591f85eaa908541d9bb4f9 (diff) | |
| download | emacs-06862374481b6ff54af8b7c52ec804984d3d6418.tar.gz emacs-06862374481b6ff54af8b7c52ec804984d3d6418.zip | |
(Mode Line Data): Document the :propertize construct.
(Mode Line Variables): Reorder the descriptions of the variables
to match their order in the default mode-line-format.
Describe the new variables mode-line-position and mode-line-modes.
Update the default values of mode-line-frame-identification,
minor-mode-alist, and default-mode-line-format.
(Properties in Mode): Mention the :propertize construct.
Diffstat (limited to 'lispref')
| -rw-r--r-- | lispref/modes.texi | 235 |
1 files changed, 134 insertions, 101 deletions
diff --git a/lispref/modes.texi b/lispref/modes.texi index 07725ab9870..b53246fd9fc 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi | |||
| @@ -274,7 +274,7 @@ recommended way to define one is to use @code{define-derived-mode}, | |||
| 274 | but this is not required. Such a mode should use | 274 | but this is not required. Such a mode should use |
| 275 | @code{delay-mode-hooks} around its entire body, including the call to | 275 | @code{delay-mode-hooks} around its entire body, including the call to |
| 276 | the parent mode command and the final call to @code{run-mode-hooks}. | 276 | the parent mode command and the final call to @code{run-mode-hooks}. |
| 277 | (Using @code{define-derived-mode} does this automatically.) | 277 | (Using @code{define-derived-mode} does this automatically.) |
| 278 | 278 | ||
| 279 | @item | 279 | @item |
| 280 | If something special should be done if the user switches a buffer from | 280 | If something special should be done if the user switches a buffer from |
| @@ -1101,7 +1101,7 @@ See the command \\[hungry-electric-delete]." | |||
| 1101 | @end smallexample | 1101 | @end smallexample |
| 1102 | 1102 | ||
| 1103 | @node Mode Line Format | 1103 | @node Mode Line Format |
| 1104 | @section Mode Line Format | 1104 | @section Mode-Line Format |
| 1105 | @cindex mode line | 1105 | @cindex mode line |
| 1106 | 1106 | ||
| 1107 | Each Emacs window (aside from minibuffer windows) typically has a mode | 1107 | Each Emacs window (aside from minibuffer windows) typically has a mode |
| @@ -1166,37 +1166,39 @@ actually appears. | |||
| 1166 | 1166 | ||
| 1167 | @node Mode Line Data | 1167 | @node Mode Line Data |
| 1168 | @subsection The Data Structure of the Mode Line | 1168 | @subsection The Data Structure of the Mode Line |
| 1169 | @cindex mode line construct | 1169 | @cindex mode-line construct |
| 1170 | 1170 | ||
| 1171 | The mode line contents are controlled by a data structure of lists, | 1171 | The mode-line contents are controlled by a data structure of lists, |
| 1172 | strings, symbols, and numbers kept in buffer-local variables. The data | 1172 | strings, symbols, and numbers kept in buffer-local variables. The data |
| 1173 | structure is called a @dfn{mode line construct}, and it is built in | 1173 | structure is called a @dfn{mode-line construct}, and it is built in |
| 1174 | recursive fashion out of simpler mode line constructs. The same data | 1174 | recursive fashion out of simpler mode-line constructs. The same data |
| 1175 | structure is used for constructing frame titles (@pxref{Frame Titles}) | 1175 | structure is used for constructing frame titles (@pxref{Frame Titles}) |
| 1176 | and header lines (@pxref{Header Lines}). | 1176 | and header lines (@pxref{Header Lines}). |
| 1177 | 1177 | ||
| 1178 | @defvar mode-line-format | 1178 | @defvar mode-line-format |
| 1179 | The value of this variable is a mode line construct with overall | 1179 | The value of this variable is a mode-line construct with overall |
| 1180 | responsibility for the mode line format. The value of this variable | 1180 | responsibility for the mode-line format. The value of this variable |
| 1181 | controls which other variables are used to form the mode line text, and | 1181 | controls which other variables are used to form the mode-line text, and |
| 1182 | where they appear. | 1182 | where they appear. |
| 1183 | 1183 | ||
| 1184 | If you set this variable to @code{nil} in a buffer, that buffer does not | 1184 | If you set this variable to @code{nil} in a buffer, that buffer does not |
| 1185 | have a mode line. (This feature was added in Emacs 21.) | 1185 | have a mode line. (This feature was added in Emacs 21.) |
| 1186 | @end defvar | 1186 | @end defvar |
| 1187 | 1187 | ||
| 1188 | A mode line construct may be as simple as a fixed string of text, but | 1188 | A mode-line construct may be as simple as a fixed string of text, but |
| 1189 | it usually specifies how to use other variables to construct the text. | 1189 | it usually specifies how to use other variables to construct the text. |
| 1190 | Many of these variables are themselves defined to have mode line | 1190 | Many of these variables are themselves defined to have mode-line |
| 1191 | constructs as their values. | 1191 | constructs as their values. |
| 1192 | 1192 | ||
| 1193 | The default value of @code{mode-line-format} incorporates the values | 1193 | The default value of @code{mode-line-format} incorporates the values |
| 1194 | of variables such as @code{mode-name} and @code{minor-mode-alist}. | 1194 | of variables such as @code{mode-line-position} and |
| 1195 | Because of this, very few modes need to alter @code{mode-line-format} | 1195 | @code{mode-line-modes} (which in turn incorporates the values of the |
| 1196 | itself. For most purposes, it is sufficient to alter some of the | 1196 | variables @code{mode-name} and @code{minor-mode-alist}). Because of |
| 1197 | variables that @code{mode-line-format} refers to. | 1197 | this, very few modes need to alter @code{mode-line-format} itself. For |
| 1198 | 1198 | most purposes, it is sufficient to alter some of the variables that | |
| 1199 | A mode line construct may be a list, a symbol, or a string. If the | 1199 | @code{mode-line-format} either directly or indirectly refers to. |
| 1200 | |||
| 1201 | A mode-line construct may be a list, a symbol, or a string. If the | ||
| 1200 | value is a list, each element may be a list, a symbol, or a string. | 1202 | value is a list, each element may be a list, a symbol, or a string. |
| 1201 | 1203 | ||
| 1202 | The mode line can display various faces, if the strings that control | 1204 | The mode line can display various faces, if the strings that control |
| @@ -1207,14 +1209,14 @@ mode line (@pxref{Standard Faces}). | |||
| 1207 | @table @code | 1209 | @table @code |
| 1208 | @cindex percent symbol in mode line | 1210 | @cindex percent symbol in mode line |
| 1209 | @item @var{string} | 1211 | @item @var{string} |
| 1210 | A string as a mode line construct is displayed verbatim in the mode line | 1212 | A string as a mode-line construct is displayed verbatim in the mode line |
| 1211 | except for @dfn{@code{%}-constructs}. Decimal digits after the @samp{%} | 1213 | except for @dfn{@code{%}-constructs}. Decimal digits after the @samp{%} |
| 1212 | specify the field width for space filling on the right (i.e., the data | 1214 | specify the field width for space filling on the right (i.e., the data |
| 1213 | is left justified). @xref{%-Constructs}. | 1215 | is left justified). @xref{%-Constructs}. |
| 1214 | 1216 | ||
| 1215 | @item @var{symbol} | 1217 | @item @var{symbol} |
| 1216 | A symbol as a mode line construct stands for its value. The value of | 1218 | A symbol as a mode-line construct stands for its value. The value of |
| 1217 | @var{symbol} is used as a mode line construct, in place of @var{symbol}. | 1219 | @var{symbol} is used as a mode-line construct, in place of @var{symbol}. |
| 1218 | However, the symbols @code{t} and @code{nil} are ignored, as is any | 1220 | However, the symbols @code{t} and @code{nil} are ignored, as is any |
| 1219 | symbol whose value is void. | 1221 | symbol whose value is void. |
| 1220 | 1222 | ||
| @@ -1224,26 +1226,34 @@ displayed verbatim: the @code{%}-constructs are not recognized. | |||
| 1224 | @item (@var{string} @var{rest}@dots{}) @r{or} (@var{list} @var{rest}@dots{}) | 1226 | @item (@var{string} @var{rest}@dots{}) @r{or} (@var{list} @var{rest}@dots{}) |
| 1225 | A list whose first element is a string or list means to process all the | 1227 | A list whose first element is a string or list means to process all the |
| 1226 | elements recursively and concatenate the results. This is the most | 1228 | elements recursively and concatenate the results. This is the most |
| 1227 | common form of mode line construct. | 1229 | common form of mode-line construct. |
| 1228 | 1230 | ||
| 1229 | @item (:eval @var{form}) | 1231 | @item (:eval @var{form}) |
| 1230 | A list whose first element is the symbol @code{:eval} says to evaluate | 1232 | A list whose first element is the symbol @code{:eval} says to evaluate |
| 1231 | @var{form}, and use the result as a string to display. | 1233 | @var{form}, and use the result as a string to display. |
| 1232 | (This feature is new as of Emacs 21.) | 1234 | (This feature is new as of Emacs 21.) |
| 1233 | 1235 | ||
| 1236 | @item (:propertize @var{elt} @var{props}@dots{}) | ||
| 1237 | A list whose first element is the symbol @code{:propertize} says to | ||
| 1238 | process the mode-line construct @var{elt} recursively and add the text | ||
| 1239 | properties specified by @var{props} to the result. The argument | ||
| 1240 | @var{props} should consist of zero or more pairs @var{text-property} | ||
| 1241 | @var{value}. (This feature is new as of Emacs 21.4.) | ||
| 1242 | @c FIXME: This might be Emacs 21.5. | ||
| 1243 | |||
| 1234 | @item (@var{symbol} @var{then} @var{else}) | 1244 | @item (@var{symbol} @var{then} @var{else}) |
| 1235 | A list whose first element is a symbol that is not a keyword specifies a | 1245 | A list whose first element is a symbol that is not a keyword specifies a |
| 1236 | conditional. Its meaning depends on the value of @var{symbol}. If the | 1246 | conditional. Its meaning depends on the value of @var{symbol}. If the |
| 1237 | value is non-@code{nil}, the second element, @var{then}, is processed | 1247 | value is non-@code{nil}, the second element, @var{then}, is processed |
| 1238 | recursively as a mode line element. But if the value of @var{symbol} is | 1248 | recursively as a mode-line element. But if the value of @var{symbol} is |
| 1239 | @code{nil}, the third element, @var{else}, is processed recursively. | 1249 | @code{nil}, the third element, @var{else}, is processed recursively. |
| 1240 | You may omit @var{else}; then the mode line element displays nothing if | 1250 | You may omit @var{else}; then the mode-line element displays nothing if |
| 1241 | the value of @var{symbol} is @code{nil}. | 1251 | the value of @var{symbol} is @code{nil}. |
| 1242 | 1252 | ||
| 1243 | @item (@var{width} @var{rest}@dots{}) | 1253 | @item (@var{width} @var{rest}@dots{}) |
| 1244 | A list whose first element is an integer specifies truncation or | 1254 | A list whose first element is an integer specifies truncation or |
| 1245 | padding of the results of @var{rest}. The remaining elements | 1255 | padding of the results of @var{rest}. The remaining elements |
| 1246 | @var{rest} are processed recursively as mode line constructs and | 1256 | @var{rest} are processed recursively as mode-line constructs and |
| 1247 | concatenated together. Then the result is space filled (if | 1257 | concatenated together. Then the result is space filled (if |
| 1248 | @var{width} is positive) or truncated (to @minus{}@var{width} columns, | 1258 | @var{width} is positive) or truncated (to @minus{}@var{width} columns, |
| 1249 | if @var{width} is negative) on the right. | 1259 | if @var{width} is negative) on the right. |
| @@ -1275,7 +1285,7 @@ directory. | |||
| 1275 | @end group | 1285 | @end group |
| 1276 | @group | 1286 | @group |
| 1277 | ;; @r{Note that this is evaluated while making the list.} | 1287 | ;; @r{Note that this is evaluated while making the list.} |
| 1278 | ;; @r{It makes a mode line construct which is just a string.} | 1288 | ;; @r{It makes a mode-line construct which is just a string.} |
| 1279 | (getenv "HOST") | 1289 | (getenv "HOST") |
| 1280 | @end group | 1290 | @end group |
| 1281 | ":" | 1291 | ":" |
| @@ -1332,8 +1342,8 @@ Changing this variable does not force an update of the mode line. | |||
| 1332 | 1342 | ||
| 1333 | @defvar mode-line-frame-identification | 1343 | @defvar mode-line-frame-identification |
| 1334 | This variable identifies the current frame. The default value is | 1344 | This variable identifies the current frame. The default value is |
| 1335 | @code{" "} if you are using a window system which can show multiple | 1345 | @code{" "} if you are using a window system which can show multiple |
| 1336 | frames, or @code{"-%F "} on an ordinary terminal which shows only one | 1346 | frames, or @code{"-%F "} on an ordinary terminal which shows only one |
| 1337 | frame at a time. | 1347 | frame at a time. |
| 1338 | @end defvar | 1348 | @end defvar |
| 1339 | 1349 | ||
| @@ -1343,24 +1353,74 @@ default value is @code{("%12b")}, which displays the buffer name, padded | |||
| 1343 | with spaces to at least 12 columns. | 1353 | with spaces to at least 12 columns. |
| 1344 | @end defvar | 1354 | @end defvar |
| 1345 | 1355 | ||
| 1346 | @defvar global-mode-string | 1356 | @defvar mode-line-position |
| 1347 | This variable holds a mode line spec that appears in the mode line by | 1357 | This variable indicates the position in the buffer. Here is a |
| 1348 | default, just after the buffer name. The command @code{display-time} | 1358 | simplified version of its default value. The actual default value |
| 1349 | sets @code{global-mode-string} to refer to the variable | 1359 | also specifies addition of the @code{help-echo} text property. |
| 1350 | @code{display-time-string}, which holds a string containing the time and | ||
| 1351 | load information. | ||
| 1352 | 1360 | ||
| 1353 | The @samp{%M} construct substitutes the value of | 1361 | @example |
| 1354 | @code{global-mode-string}, but that is obsolete, since the variable is | 1362 | @group |
| 1355 | included in the mode line from @code{mode-line-format}. | 1363 | ((-3 . "%p") |
| 1364 | (size-indication-mode (8 " of %I")) | ||
| 1365 | @end group | ||
| 1366 | @group | ||
| 1367 | (line-number-mode | ||
| 1368 | ((column-number-mode | ||
| 1369 | (10 " (%l,%c)") | ||
| 1370 | (6 " L%l"))) | ||
| 1371 | ((column-number-mode | ||
| 1372 | (5 " C%c"))))) | ||
| 1373 | @end group | ||
| 1374 | @end example | ||
| 1375 | |||
| 1376 | This means that @code{mode-line-position} displays at least the buffer | ||
| 1377 | percentage and possibly the buffer size, the line number and the column | ||
| 1378 | number. | ||
| 1379 | @end defvar | ||
| 1380 | |||
| 1381 | @defvar vc-mode | ||
| 1382 | The variable @code{vc-mode}, buffer-local in each buffer, records | ||
| 1383 | whether the buffer's visited file is maintained with version control, | ||
| 1384 | and, if so, which kind. Its value is a string that appears in the mode | ||
| 1385 | line, or @code{nil} for no version control. | ||
| 1356 | @end defvar | 1386 | @end defvar |
| 1357 | 1387 | ||
| 1388 | @defvar mode-line-modes | ||
| 1389 | This variable displays the buffer's major and minor modes. Here is a | ||
| 1390 | simplified version of its default value. The real default value also | ||
| 1391 | specifies addition of text properties. | ||
| 1392 | |||
| 1393 | @example | ||
| 1394 | @group | ||
| 1395 | ("%[(" mode-name | ||
| 1396 | mode-line-process minor-mode-alist | ||
| 1397 | "%n" ")%]--") | ||
| 1398 | @end group | ||
| 1399 | @end example | ||
| 1400 | |||
| 1401 | So @code{mode-line-modes} normally also displays the recursive editing | ||
| 1402 | level, information on the process status and whether narrowing is in | ||
| 1403 | effect. | ||
| 1404 | @end defvar | ||
| 1405 | |||
| 1406 | The following three variables are used in @code{mode-line-modes}: | ||
| 1407 | |||
| 1358 | @defvar mode-name | 1408 | @defvar mode-name |
| 1359 | This buffer-local variable holds the ``pretty'' name of the current | 1409 | This buffer-local variable holds the ``pretty'' name of the current |
| 1360 | buffer's major mode. Each major mode should set this variable so that the | 1410 | buffer's major mode. Each major mode should set this variable so that the |
| 1361 | mode name will appear in the mode line. | 1411 | mode name will appear in the mode line. |
| 1362 | @end defvar | 1412 | @end defvar |
| 1363 | 1413 | ||
| 1414 | @defvar mode-line-process | ||
| 1415 | This buffer-local variable contains the mode-line information on process | ||
| 1416 | status in modes used for communicating with subprocesses. It is | ||
| 1417 | displayed immediately following the major mode name, with no intervening | ||
| 1418 | space. For example, its value in the @samp{*shell*} buffer is | ||
| 1419 | @code{(":%s")}, which allows the shell to display its status along | ||
| 1420 | with the major mode as: @samp{(Shell:run)}. Normally this variable | ||
| 1421 | is @code{nil}. | ||
| 1422 | @end defvar | ||
| 1423 | |||
| 1364 | @defvar minor-mode-alist | 1424 | @defvar minor-mode-alist |
| 1365 | This variable holds an association list whose elements specify how the | 1425 | This variable holds an association list whose elements specify how the |
| 1366 | mode line should indicate that a minor mode is active. Each element of | 1426 | mode line should indicate that a minor mode is active. Each element of |
| @@ -1370,51 +1430,28 @@ the @code{minor-mode-alist} should be a two-element list: | |||
| 1370 | (@var{minor-mode-variable} @var{mode-line-string}) | 1430 | (@var{minor-mode-variable} @var{mode-line-string}) |
| 1371 | @end example | 1431 | @end example |
| 1372 | 1432 | ||
| 1373 | More generally, @var{mode-line-string} can be any mode line spec. It | 1433 | More generally, @var{mode-line-string} can be any mode-line spec. It |
| 1374 | appears in the mode line when the value of @var{minor-mode-variable} is | 1434 | appears in the mode line when the value of @var{minor-mode-variable} |
| 1375 | non-@code{nil}, and not otherwise. These strings should begin with | 1435 | is non-@code{nil}, and not otherwise. These strings should begin with |
| 1376 | spaces so that they don't run together. Conventionally, the | 1436 | spaces so that they don't run together. Conventionally, the |
| 1377 | @var{minor-mode-variable} for a specific mode is set to a non-@code{nil} | 1437 | @var{minor-mode-variable} for a specific mode is set to a |
| 1378 | value when that minor mode is activated. | 1438 | non-@code{nil} value when that minor mode is activated. |
| 1379 | |||
| 1380 | The default value of @code{minor-mode-alist} is: | ||
| 1381 | |||
| 1382 | @example | ||
| 1383 | @group | ||
| 1384 | minor-mode-alist | ||
| 1385 | @result{} ((vc-mode vc-mode) | ||
| 1386 | (abbrev-mode " Abbrev") | ||
| 1387 | (overwrite-mode overwrite-mode) | ||
| 1388 | (auto-fill-function " Fill") | ||
| 1389 | (defining-kbd-macro " Def") | ||
| 1390 | (isearch-mode isearch-mode)) | ||
| 1391 | @end group | ||
| 1392 | @end example | ||
| 1393 | 1439 | ||
| 1394 | @code{minor-mode-alist} itself is not buffer-local. Each variable | 1440 | @code{minor-mode-alist} itself is not buffer-local. Each variable |
| 1395 | mentioned in the alist should be buffer-local if its minor mode can be | 1441 | mentioned in the alist should be buffer-local if its minor mode can be |
| 1396 | enabled separately in each buffer. | 1442 | enabled separately in each buffer. |
| 1397 | @end defvar | 1443 | @end defvar |
| 1398 | 1444 | ||
| 1399 | @defvar mode-line-process | 1445 | @defvar global-mode-string |
| 1400 | This buffer-local variable contains the mode line information on process | 1446 | This variable holds a mode-line spec that appears in the mode line by |
| 1401 | status in modes used for communicating with subprocesses. It is | 1447 | default, just after the buffer name. The command @code{display-time} |
| 1402 | displayed immediately following the major mode name, with no intervening | 1448 | sets @code{global-mode-string} to refer to the variable |
| 1403 | space. For example, its value in the @samp{*shell*} buffer is | 1449 | @code{display-time-string}, which holds a string containing the time and |
| 1404 | @code{(":%s")}, which allows the shell to display its status along | 1450 | load information. |
| 1405 | with the major mode as: @samp{(Shell:run)}. Normally this variable | ||
| 1406 | is @code{nil}. | ||
| 1407 | @end defvar | ||
| 1408 | |||
| 1409 | Some variables are used by @code{minor-mode-alist} to display | ||
| 1410 | a string for various minor modes when enabled. This is a typical | ||
| 1411 | example: | ||
| 1412 | 1451 | ||
| 1413 | @defvar vc-mode | 1452 | The @samp{%M} construct substitutes the value of |
| 1414 | The variable @code{vc-mode}, buffer-local in each buffer, records | 1453 | @code{global-mode-string}, but that is obsolete, since the variable is |
| 1415 | whether the buffer's visited file is maintained with version control, | 1454 | included in the mode line from @code{mode-line-format}. |
| 1416 | and, if so, which kind. Its value is a string that appears in the mode | ||
| 1417 | line, or @code{nil} for no version control. | ||
| 1418 | @end defvar | 1455 | @end defvar |
| 1419 | 1456 | ||
| 1420 | The variable @code{default-mode-line-format} is where | 1457 | The variable @code{default-mode-line-format} is where |
| @@ -1425,7 +1462,9 @@ This variable holds the default @code{mode-line-format} for buffers | |||
| 1425 | that do not override it. This is the same as @code{(default-value | 1462 | that do not override it. This is the same as @code{(default-value |
| 1426 | 'mode-line-format)}. | 1463 | 'mode-line-format)}. |
| 1427 | 1464 | ||
| 1428 | The default value of @code{default-mode-line-format} is this list: | 1465 | Here is a simplified version of the default value of |
| 1466 | @code{default-mode-line-format}. The real default value also | ||
| 1467 | specifies addition of text properties. | ||
| 1429 | 1468 | ||
| 1430 | @example | 1469 | @example |
| 1431 | @group | 1470 | @group |
| @@ -1436,23 +1475,13 @@ The default value of @code{default-mode-line-format} is this list: | |||
| 1436 | mode-line-buffer-identification | 1475 | mode-line-buffer-identification |
| 1437 | @end group | 1476 | @end group |
| 1438 | " " | 1477 | " " |
| 1439 | global-mode-string | 1478 | mode-line-position |
| 1440 | @group | 1479 | (vc-mode vc-mode) |
| 1441 | " %[(" | 1480 | " " |
| 1442 | ;; @r{@code{mode-line-mode-name} is a function} | ||
| 1443 | ;; @r{that copies the mode name and adds text} | ||
| 1444 | ;; @r{properties to make it mouse-sensitive.} | ||
| 1445 | (:eval (mode-line-mode-name)) | ||
| 1446 | mode-line-process | ||
| 1447 | minor-mode-alist | ||
| 1448 | "%n" | ||
| 1449 | ")%]--" | ||
| 1450 | @end group | ||
| 1451 | @group | 1481 | @group |
| 1482 | mode-line-modes | ||
| 1452 | (which-func-mode ("" which-func-format "--")) | 1483 | (which-func-mode ("" which-func-format "--")) |
| 1453 | (line-number-mode "L%l--") | 1484 | (global-mode-string ("--" global-mode-string)) |
| 1454 | (column-number-mode "C%c--") | ||
| 1455 | (-3 . "%p") | ||
| 1456 | "-%-") | 1485 | "-%-") |
| 1457 | @end group | 1486 | @end group |
| 1458 | @end example | 1487 | @end example |
| @@ -1564,29 +1593,33 @@ The value of @code{global-mode-string}. Currently, only | |||
| 1564 | 1593 | ||
| 1565 | @node Properties in Mode | 1594 | @node Properties in Mode |
| 1566 | @subsection Properties in the Mode Line | 1595 | @subsection Properties in the Mode Line |
| 1596 | @cindex text properties in the mode line | ||
| 1567 | 1597 | ||
| 1568 | Starting in Emacs 21, certain text properties are meaningful in the | 1598 | Starting in Emacs 21, certain text properties are meaningful in the |
| 1569 | mode line. The @code{face} property affects the appearance of text; the | 1599 | mode line. The @code{face} property affects the appearance of text; the |
| 1570 | @code{help-echo} property associate help strings with the text, and | 1600 | @code{help-echo} property associate help strings with the text, and |
| 1571 | @code{local-map} can make the text mouse-sensitive. | 1601 | @code{local-map} can make the text mouse-sensitive. |
| 1572 | 1602 | ||
| 1573 | There are three ways to specify text properties for text in the mode | 1603 | There are four ways to specify text properties for text in the mode |
| 1574 | line: | 1604 | line: |
| 1575 | 1605 | ||
| 1576 | @enumerate | 1606 | @enumerate |
| 1577 | @item | 1607 | @item |
| 1578 | Put a string with the @code{local-map} property directly into the | 1608 | Put a string with a text property directly into the mode-line data |
| 1579 | mode-line data structure. | 1609 | structure. |
| 1610 | |||
| 1611 | @item | ||
| 1612 | Put a text property on a mode-line %-construct such as @samp{%12b}; then | ||
| 1613 | the expansion of the %-construct will have that same text property. | ||
| 1580 | 1614 | ||
| 1581 | @item | 1615 | @item |
| 1582 | Put a @code{local-map} property on a mode-line %-construct | 1616 | Use a @code{(:propertize @var{elt} @var{props}@dots{})} construct to |
| 1583 | such as @samp{%12b}; then the expansion of the %-construct | 1617 | give @var{elt} a text property specified by @var{props}. |
| 1584 | will have that same text property. | ||
| 1585 | 1618 | ||
| 1586 | @item | 1619 | @item |
| 1587 | Use a list containing @code{:eval @var{form}} in the mode-line data | 1620 | Use a list containing @code{:eval @var{form}} in the mode-line data |
| 1588 | structure, and make @var{form} evaluate to a string that has a | 1621 | structure, and make @var{form} evaluate to a string that has a text |
| 1589 | @code{local-map} property. | 1622 | property. |
| 1590 | @end enumerate | 1623 | @end enumerate |
| 1591 | 1624 | ||
| 1592 | You use the @code{local-map} property to specify a keymap. Like any | 1625 | You use the @code{local-map} property to specify a keymap. Like any |
| @@ -1601,7 +1634,7 @@ keymap can only take real effect for mouse clicks. | |||
| 1601 | 1634 | ||
| 1602 | Starting in Emacs 21, a window can have a @dfn{header line} at the | 1635 | Starting in Emacs 21, a window can have a @dfn{header line} at the |
| 1603 | top, just as it can have a mode line at the bottom. The header line | 1636 | top, just as it can have a mode line at the bottom. The header line |
| 1604 | feature works just like the mode line feature, except that it's | 1637 | feature works just like the mode-line feature, except that it's |
| 1605 | controlled by different variables. | 1638 | controlled by different variables. |
| 1606 | 1639 | ||
| 1607 | @tindex header-line-format | 1640 | @tindex header-line-format |
| @@ -1621,11 +1654,11 @@ It is normally @code{nil}, so that ordinary buffers have no header line. | |||
| 1621 | @end defvar | 1654 | @end defvar |
| 1622 | 1655 | ||
| 1623 | @node Emulating Mode Line | 1656 | @node Emulating Mode Line |
| 1624 | @subsection Emulating Mode Line Formatting | 1657 | @subsection Emulating Mode-Line Formatting |
| 1625 | 1658 | ||
| 1626 | You can use the function @code{format-mode-line} to compute | 1659 | You can use the function @code{format-mode-line} to compute |
| 1627 | the text that would appear in a mode line or header line | 1660 | the text that would appear in a mode line or header line |
| 1628 | based on certain mode line specification. | 1661 | based on certain mode-line specification. |
| 1629 | 1662 | ||
| 1630 | @defun format-mode-line &optional format window no-props | 1663 | @defun format-mode-line &optional format window no-props |
| 1631 | This function formats a line of text according to @var{format} as if | 1664 | This function formats a line of text according to @var{format} as if |
| @@ -2214,7 +2247,7 @@ fontification, you may use the special character property | |||
| 2214 | @code{font-lock-face} (@pxref{Special Properties}). This property | 2247 | @code{font-lock-face} (@pxref{Special Properties}). This property |
| 2215 | acts just like the explicit @code{face} property, but its activation | 2248 | acts just like the explicit @code{face} property, but its activation |
| 2216 | is toggled when the user calls @kbd{M-x font-lock-mode}. Using | 2249 | is toggled when the user calls @kbd{M-x font-lock-mode}. Using |
| 2217 | @code{font-lock-face} is especially conveninent for special modes | 2250 | @code{font-lock-face} is especially convenient for special modes |
| 2218 | which construct their text programmatically, such as | 2251 | which construct their text programmatically, such as |
| 2219 | @code{list-buffers} and @code{occur}. | 2252 | @code{list-buffers} and @code{occur}. |
| 2220 | 2253 | ||