comparison lispref/modes.texi @ 12067:73dc8205d259

*** empty log message ***
author Karl Heuer <kwzh@gnu.org>
date Mon, 05 Jun 1995 12:23:13 +0000
parents 6989a95d5247
children a6eb5f12b0f3
comparison
equal deleted inserted replaced
12066:b9b0b3f96dc2 12067:73dc8205d259
545 Fundamental mode is used instead. The modes that have this property are 545 Fundamental mode is used instead. The modes that have this property are
546 those such as Dired and Rmail that are useful only with text that has 546 those such as Dired and Rmail that are useful only with text that has
547 been specially prepared. 547 been specially prepared.
548 @end defopt 548 @end defopt
549 549
550 @defun set-buffer-major-mode buffer
551 This function sets the major mode of @var{buffer} to the value of
552 @code{default-major-mode}. If that variable is @code{nil}, it uses
553 the current buffer's major mode (if that is suitable).
554
555 The low-level primitives for creating buffers do not use this function,
556 but medium-level commands such as @code{switch-to-buffer} should use it
557 whenever they create buffers.
558 @end defun
559
550 @defvar initial-major-mode 560 @defvar initial-major-mode
551 @cindex @samp{*scratch*} 561 @cindex @samp{*scratch*}
552 The value of this variable determines the major mode of the initial 562 The value of this variable determines the major mode of the initial
553 @samp{*scratch*} buffer. The value should be a symbol that is a major 563 @samp{*scratch*} buffer. The value should be a symbol that is a major
554 mode command name. The default value is @code{lisp-interaction-mode}. 564 mode command name. The default value is @code{lisp-interaction-mode}.
927 937
928 The mode line contents are controlled by a data structure of lists, 938 The mode line contents are controlled by a data structure of lists,
929 strings, symbols, and numbers kept in the buffer-local variable 939 strings, symbols, and numbers kept in the buffer-local variable
930 @code{mode-line-format}. The data structure is called a @dfn{mode line 940 @code{mode-line-format}. The data structure is called a @dfn{mode line
931 construct}, and it is built in recursive fashion out of simpler mode line 941 construct}, and it is built in recursive fashion out of simpler mode line
932 constructs. 942 constructs. The same data structure is used for constructing
943 frame titles (pxref{Frame Titles}).
933 944
934 @defvar mode-line-format 945 @defvar mode-line-format
935 The value of this variable is a mode line construct with overall 946 The value of this variable is a mode line construct with overall
936 responsibility for the mode line format. The value of this variable 947 responsibility for the mode line format. The value of this variable
937 controls which other variables are used to form the mode line text, and 948 controls which other variables are used to form the mode line text, and
1175 1186
1176 @item %f 1187 @item %f
1177 The visited file name, obtained with the @code{buffer-file-name} 1188 The visited file name, obtained with the @code{buffer-file-name}
1178 function. @xref{Buffer File Name}. 1189 function. @xref{Buffer File Name}.
1179 1190
1191 @item %F
1192 The name of the selected frame.
1193
1194 @item %c
1195 The current column number of point.
1196
1197 @item %l
1198 The current line number of point.
1199
1180 @item %* 1200 @item %*
1181 @samp{%} if the buffer is read only (see @code{buffer-read-only}); @* 1201 @samp{%} if the buffer is read only (see @code{buffer-read-only}); @*
1182 @samp{*} if the buffer is modified (see @code{buffer-modified-p}); @* 1202 @samp{*} if the buffer is modified (see @code{buffer-modified-p}); @*
1183 @samp{-} otherwise. @xref{Buffer Modification}. 1203 @samp{-} otherwise. @xref{Buffer Modification}.
1184 1204
1185 @item %+ 1205 @item %+
1206 @samp{*} if the buffer is modified (see @code{buffer-modified-p}); @*
1207 @samp{%} if the buffer is read only (see @code{buffer-read-only}); @*
1208 @samp{-} otherwise. This differs from @samp{%*} only for a modified
1209 read-only buffer. @xref{Buffer Modification}.
1210
1211 @item %&
1186 @samp{*} if the buffer is modified, and @samp{-} otherwise. 1212 @samp{*} if the buffer is modified, and @samp{-} otherwise.
1187 1213
1188 @item %s 1214 @item %s
1189 The status of the subprocess belonging to the current buffer, obtained with 1215 The status of the subprocess belonging to the current buffer, obtained with
1190 @code{process-status}. @xref{Process Information}. 1216 @code{process-status}. @xref{Process Information}.
1191 1217
1218 @item %t
1219 Whether the visited file is a text file or a binary file. (This is a
1220 meaningful distinction only on certain operating systems.)
1221
1192 @item %p 1222 @item %p
1193 The percent of the buffer above the @strong{top} of window, or 1223 The percentage of the buffer text above the @strong{top} of window, or
1194 @samp{Top}, @samp{Bottom} or @samp{All}. 1224 @samp{Top}, @samp{Bottom} or @samp{All}.
1195 1225
1196 @item %P 1226 @item %P
1197 The percentage of the buffer text that is above the @strong{bottom} of 1227 The percentage of the buffer text that is above the @strong{bottom} of
1198 the window (which includes the text visible in the window, as well as 1228 the window (which includes the text visible in the window, as well as
1351 @example 1381 @example
1352 (run-hooks 'emacs-lisp-mode-hook) 1382 (run-hooks 'emacs-lisp-mode-hook)
1353 @end example 1383 @end example
1354 @end defun 1384 @end defun
1355 1385
1356 @defun add-hook hook function &optional append 1386 @defun add-hook hook function &optional append local
1357 This function is the handy way to add function @var{function} to hook 1387 This function is the handy way to add function @var{function} to hook
1358 variable @var{hook}. The argument @var{function} may be any valid Lisp 1388 variable @var{hook}. The argument @var{function} may be any valid Lisp
1359 function with the proper number of arguments. For example, 1389 function with the proper number of arguments. For example,
1360 1390
1361 @example 1391 @example
1374 @var{function} goes at the front of the hook list, so it will be 1404 @var{function} goes at the front of the hook list, so it will be
1375 executed first (barring another @code{add-hook} call). 1405 executed first (barring another @code{add-hook} call).
1376 1406
1377 If the optional argument @var{append} is non-@code{nil}, the new hook 1407 If the optional argument @var{append} is non-@code{nil}, the new hook
1378 function goes at the end of the hook list and will be executed last. 1408 function goes at the end of the hook list and will be executed last.
1409
1410 If @var{local} is non-@code{nil}, that says to make the new hook
1411 function local to the current buffer. Before you can do this, you must
1412 make the hook itself buffer-local by calling @code{make-local-hook}
1413 (@strong{not} @code{make-local-variable}). If the hook itself is not
1414 buffer-local, then the value of @var{local} makes no difference---the
1415 hook function is always global.
1379 @end defun 1416 @end defun
1380 1417
1381 @defun remove-hook hook function 1418 @defun remove-hook hook function &optional local
1382 This function removes @var{function} from the hook variable @var{hook}. 1419 This function removes @var{function} from the hook variable @var{hook}.
1420
1421 If @var{local} is non-@code{nil}, that says to remove @var{function}
1422 from the local hook list instead of from the global hook list. If the
1423 hook itself is not buffer-local, then the value of @var{local} makes no
1424 difference.
1383 @end defun 1425 @end defun
1384 1426
1385 @ignore @c Should no longer be necessary 1427 @defun make-local-hook hook
1386 If you make a hook variable buffer-local, copy its value before you use 1428 This function makes the hook variable @code{hook} local to the current
1387 @code{add-hook} or @code{remove-hook} to change it. For example, 1429 buffer. When a hook variable is local, it can have local and global
1388 1430 hook functions, and @code{run-hooks} runs all of them.
1389 @example 1431
1390 (defun my-major-mode () 1432 Do not use @code{make-local-variable} directly for hook variables; it is
1391 @dots{} 1433 not sufficient.
1392 (make-local-variable 'foo-hook) 1434 @end defun
1393 (if (boundp 'foo-hook)
1394 (setq foo-hook (copy-sequence foo-hook)))
1395 (add-hook 'foo-hook 'my-foo-function)"
1396 @dots{}
1397 )
1398 @end example
1399
1400 Otherwise you may accidentally alter the list structure that forms part
1401 of the global value of the hook variable.
1402 @end ignore