diff options
Diffstat (limited to 'lispref')
| -rw-r--r-- | lispref/ChangeLog | 20 | ||||
| -rw-r--r-- | lispref/files.texi | 47 | ||||
| -rw-r--r-- | lispref/frames.texi | 21 | ||||
| -rw-r--r-- | lispref/modes.texi | 62 |
4 files changed, 84 insertions, 66 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 25909586102..6077deea9bb 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2005-05-29 Luc Teirlinck <teirllm@auburn.edu> | ||
| 2 | |||
| 3 | * modes.texi (Major Mode Conventions): A derived mode only needs | ||
| 4 | to put the call to the parent mode inside `delay-mode-hooks'. | ||
| 5 | |||
| 6 | 2005-05-29 Richard M. Stallman <rms@gnu.org> | ||
| 7 | |||
| 8 | * modes.texi (Mode Hooks): Explain that after-change-major-mode-hook is | ||
| 9 | new, and what that implies. Clarify. | ||
| 10 | |||
| 11 | * files.texi (Locating Files): Clean up the text. | ||
| 12 | |||
| 13 | * frames.texi (Window Frame Parameters): Document user-size. | ||
| 14 | Shorten entry for top by referring to left. | ||
| 15 | |||
| 16 | 2005-05-26 Richard M. Stallman <rms@gnu.org> | ||
| 17 | |||
| 18 | * modes.texi (Mode Hooks): Explain that after-change-major-mode-hook | ||
| 19 | is new, and what the implications are. Other clarifications. | ||
| 20 | |||
| 1 | 2005-05-24 Richard M. Stallman <rms@gnu.org> | 21 | 2005-05-24 Richard M. Stallman <rms@gnu.org> |
| 2 | 22 | ||
| 3 | * frames.texi (Dialog Boxes): Minor fixes. | 23 | * frames.texi (Dialog Boxes): Minor fixes. |
diff --git a/lispref/files.texi b/lispref/files.texi index 25c4dfeb0d0..766220aa882 100644 --- a/lispref/files.texi +++ b/lispref/files.texi | |||
| @@ -1261,36 +1261,36 @@ is on file system number -32252. | |||
| 1261 | @cindex locate files | 1261 | @cindex locate files |
| 1262 | @cindex find files | 1262 | @cindex find files |
| 1263 | 1263 | ||
| 1264 | Sometimes, you need to find a file that could reside in one of the | 1264 | This section explains how to search for a file in a list of |
| 1265 | standard directories. One example is when you need to look for a | 1265 | directories. One example is when you need to look for a program's |
| 1266 | program's executable file, e.g., to find out whether a given program | 1266 | executable file, e.g., to find out whether a given program is |
| 1267 | is installed on the user's system. Another example is the search for | 1267 | installed on the user's system. Another example is the search for |
| 1268 | Lisp libraries (@pxref{Library Search}). Such searches generally need | 1268 | Lisp libraries (@pxref{Library Search}). Such searches generally need |
| 1269 | to try several alternative file name extensions, in addition to | 1269 | to try various possible file name extensions, in addition to various |
| 1270 | looking in every standard directory where the file could be found. | 1270 | possible directories. Emacs provides a function for such a |
| 1271 | Emacs provides a function for such a generalized search for a file. | 1271 | generalized search for a file. |
| 1272 | 1272 | ||
| 1273 | @defun locate-file filename path &optional suffixes predicate | 1273 | @defun locate-file filename path &optional suffixes predicate |
| 1274 | This function searches for the file whose name is @var{filename} in | 1274 | This function searches for a file whose name is @var{filename} in a |
| 1275 | a list of directories given by @var{path}. If it finds the file, it | 1275 | list of directories given by @var{path}, trying the suffixes in |
| 1276 | returns its full @dfn{absolute file name} (@pxref{Relative File | 1276 | @var{suffixes}. If it finds such a file, it returns the full |
| 1277 | Names}); if the file is not found, the function returns @code{nil}. | 1277 | @dfn{absolute file name} of the file (@pxref{Relative File Names}); |
| 1278 | otherwise it returns @code{nil}. | ||
| 1278 | 1279 | ||
| 1279 | The optional argument @var{suffixes} gives the list of file-name | 1280 | The optional argument @var{suffixes} gives the list of file-name |
| 1280 | suffixes to append to @var{filename} when searching. If | 1281 | suffixes to append to @var{filename} when searching. |
| 1281 | @var{suffixes} is @code{nil}, it's equivalent to passing a list with a | 1282 | @code{locate-file} tries each possible directory with each of these |
| 1282 | single element that is an empty string @code{""}. | 1283 | suffixes. If @var{suffixes} is @code{nil}, or @code{("")}, then there |
| 1283 | 1284 | are no suffixes, and @var{filename} is used only as-is. Typical | |
| 1284 | Typical values of @var{path} are @code{exec-path} (@pxref{Subprocess | 1285 | values of @var{suffixes} are @code{exec-suffixes} (@pxref{Subprocess |
| 1286 | Creation, exec-suffixes}) and @code{load-suffixes} (@pxref{Library | ||
| 1287 | Search, load-suffixes}). | ||
| 1288 | |||
| 1289 | Typical values for @var{path} are @code{exec-path} (@pxref{Subprocess | ||
| 1285 | Creation, exec-path}) when looking for executable programs or | 1290 | Creation, exec-path}) when looking for executable programs or |
| 1286 | @code{load-path} (@pxref{Library Search, load-path}) when looking for | 1291 | @code{load-path} (@pxref{Library Search, load-path}) when looking for |
| 1287 | Lisp files. Use @code{("/")} to disable the path search (e.g., if | 1292 | Lisp files. If @var{filename} is absolute, @var{path} has no effect, |
| 1288 | @var{filename} already includes the leading directories), but still | 1293 | but the suffixes in @var{suffixes} are still tried. |
| 1289 | try the extensions in @var{suffixes}. | ||
| 1290 | |||
| 1291 | Typical values of @var{suffixes} are @code{exec-suffixes} | ||
| 1292 | (@pxref{Subprocess Creation, exec-suffixes}) and @code{load-suffixes} | ||
| 1293 | (@pxref{Library Search, load-suffixes}). | ||
| 1294 | 1294 | ||
| 1295 | The optional argument @var{predicate}, if non-@code{nil}, specifies | 1295 | The optional argument @var{predicate}, if non-@code{nil}, specifies |
| 1296 | the predicate function to use for testing whether a candidate file is | 1296 | the predicate function to use for testing whether a candidate file is |
| @@ -1316,7 +1316,6 @@ in @code{exec-path} and tries all the file-name extensions in | |||
| 1316 | @code{exec-suffixes}. | 1316 | @code{exec-suffixes}. |
| 1317 | @end defun | 1317 | @end defun |
| 1318 | 1318 | ||
| 1319 | |||
| 1320 | @node Changing Files | 1319 | @node Changing Files |
| 1321 | @section Changing File Names and Attributes | 1320 | @section Changing File Names and Attributes |
| 1322 | @cindex renaming files | 1321 | @cindex renaming files |
diff --git a/lispref/frames.texi b/lispref/frames.texi index 77694c87130..ffcc16f6289 100644 --- a/lispref/frames.texi +++ b/lispref/frames.texi | |||
| @@ -362,20 +362,8 @@ non-@code{nil} value for the @code{user-position} parameter as well. | |||
| 362 | 362 | ||
| 363 | @item top | 363 | @item top |
| 364 | The screen position of the top edge, in pixels, with respect to the | 364 | The screen position of the top edge, in pixels, with respect to the |
| 365 | top edge of the screen. The value may be a positive number @var{pos}, | 365 | top edge of the screen. It works just like @code{left}, except vertically |
| 366 | or a list of the form @code{(+ @var{pos})} which permits specifying a | 366 | instead of horizontally. |
| 367 | negative @var{pos} value. | ||
| 368 | |||
| 369 | A negative number @minus{}@var{pos}, or a list of the form @code{(- | ||
| 370 | @var{pos})}, actually specifies the position of the bottom edge of the | ||
| 371 | window with respect to the bottom edge of the screen. A positive value | ||
| 372 | of @var{pos} counts toward the top. @strong{Reminder:} if the | ||
| 373 | parameter is a negative integer @minus{}@var{pos}, then @var{pos} is | ||
| 374 | positive. | ||
| 375 | |||
| 376 | Some window managers ignore program-specified positions. If you want to | ||
| 377 | be sure the position you specify is not ignored, specify a | ||
| 378 | non-@code{nil} value for the @code{user-position} parameter as well. | ||
| 379 | 367 | ||
| 380 | @item icon-left | 368 | @item icon-left |
| 381 | The screen position of the left edge @emph{of the frame's icon}, in | 369 | The screen position of the left edge @emph{of the frame's icon}, in |
| @@ -418,6 +406,11 @@ pixels, call @code{frame-pixel-height}; see @ref{Size and Position}.) | |||
| 418 | The width of the frame contents, in characters. (To get the height in | 406 | The width of the frame contents, in characters. (To get the height in |
| 419 | pixels, call @code{frame-pixel-width}; see @ref{Size and Position}.) | 407 | pixels, call @code{frame-pixel-width}; see @ref{Size and Position}.) |
| 420 | 408 | ||
| 409 | @item user-size | ||
| 410 | This does for the size parameters @code{height} and @code{width} what | ||
| 411 | the @code{user-position} parameter (see above) does for the position | ||
| 412 | parameters @code{top} and @code{left}. | ||
| 413 | |||
| 421 | @item fullscreen | 414 | @item fullscreen |
| 422 | Specify that width, height or both shall be set to the size of the screen. | 415 | Specify that width, height or both shall be set to the size of the screen. |
| 423 | The value @code{fullwidth} specifies that width shall be the size of the | 416 | The value @code{fullwidth} specifies that width shall be the size of the |
diff --git a/lispref/modes.texi b/lispref/modes.texi index 61bc878b581..f8c1ae82a4e 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi | |||
| @@ -437,10 +437,8 @@ The major mode command may start by calling some other major mode | |||
| 437 | command (called the @dfn{parent mode}) and then alter some of its | 437 | command (called the @dfn{parent mode}) and then alter some of its |
| 438 | settings. A mode that does this is called a @dfn{derived mode}. The | 438 | settings. A mode that does this is called a @dfn{derived mode}. The |
| 439 | recommended way to define one is to use @code{define-derived-mode}, | 439 | recommended way to define one is to use @code{define-derived-mode}, |
| 440 | but this is not required. Such a mode should use | 440 | but this is not required. Such a mode should call the parent mode |
| 441 | @code{delay-mode-hooks} around its entire body (including the call to | 441 | command inside a @code{delay-mode-hooks} form. (Using |
| 442 | the parent mode command) @emph{except} for the final call to | ||
| 443 | @code{run-mode-hooks}, which runs the derived mode's hook. (Using | ||
| 444 | @code{define-derived-mode} does this automatically.) @xref{Derived | 442 | @code{define-derived-mode} does this automatically.) @xref{Derived |
| 445 | Modes}, and @ref{Mode Hooks}. | 443 | Modes}, and @ref{Mode Hooks}. |
| 446 | 444 | ||
| @@ -1117,7 +1115,7 @@ it runs the mode hook variable @code{@var{mode}-hook}. | |||
| 1117 | @node Mode Hooks | 1115 | @node Mode Hooks |
| 1118 | @subsection Mode Hooks | 1116 | @subsection Mode Hooks |
| 1119 | 1117 | ||
| 1120 | The two last things a major mode function does is to run its mode | 1118 | The two last things a major mode function should do is run its mode |
| 1121 | hook and finally the mode independent normal hook | 1119 | hook and finally the mode independent normal hook |
| 1122 | @code{after-change-major-mode-hook}. If the major mode is a derived | 1120 | @code{after-change-major-mode-hook}. If the major mode is a derived |
| 1123 | mode, that is if it calls another major mode (the parent mode) in its | 1121 | mode, that is if it calls another major mode (the parent mode) in its |
| @@ -1125,45 +1123,53 @@ body, then the parent's mode hook is run just before the derived | |||
| 1125 | mode's hook. Neither the parent's mode hook nor | 1123 | mode's hook. Neither the parent's mode hook nor |
| 1126 | @code{after-change-major-mode-hook} are run at the end of the actual | 1124 | @code{after-change-major-mode-hook} are run at the end of the actual |
| 1127 | call to the parent mode. This applies recursively if the parent mode | 1125 | call to the parent mode. This applies recursively if the parent mode |
| 1128 | has itself a parent. That is, the mode hooks of all major modes called | 1126 | has itself a parent. That is, the mode hooks of all major modes |
| 1129 | directly or indirectly by the major mode function are all run in | 1127 | called directly or indirectly by the major mode function are all run |
| 1130 | sequence at the end, just before @code{after-change-major-mode-hook}. | 1128 | in sequence at the end, just before |
| 1131 | 1129 | @code{after-change-major-mode-hook}. | |
| 1132 | If you are customizing a major mode, rather than defining one, the | 1130 | |
| 1133 | above is all you need to know about the hooks run at the end of a | 1131 | These conventions are new in Emacs 22, and some major modes |
| 1134 | major mode. This also applies if you use @code{define-derived-mode} | 1132 | implemented by users do not follow them yet. So if you put a function |
| 1135 | to define a major mode, because that macro will automatically | 1133 | onto @code{after-change-major-mode-hook}, keep in mind that some modes |
| 1136 | implement the above for you. | 1134 | will fail to run it. If a user complains about that, you can respond, |
| 1137 | 1135 | ``That major mode fails to follow Emacs conventions, and that's why it | |
| 1138 | Programmers wishing to define a major mode without using | 1136 | fails to work. Please fix the major mode.'' In most cases, that is |
| 1139 | @code{define-derived-mode}, should make sure that their major mode | 1137 | good enough, so go ahead and use @code{after-change-major-mode-hook}. |
| 1140 | follows the above conventions. @xref{Major Mode Conventions}, for how | 1138 | However, if a certain feature needs to be completely reliable, |
| 1141 | this should be accomplished. Below, we give some implementation | 1139 | it should not use @code{after-change-major-mode-hook} as of yet. |
| 1142 | details. | 1140 | |
| 1141 | When you defined a major mode using @code{define-derived-mode}, it | ||
| 1142 | automatically makes sure these conventions are followed. If you | ||
| 1143 | define a major mode ``from scratch'', not using | ||
| 1144 | @code{define-derived-mode}, make sure the major mode command follows | ||
| 1145 | these and other conventions. @xref{Major Mode Conventions}. You use | ||
| 1146 | these functions to do it properly. | ||
| 1143 | 1147 | ||
| 1144 | @defun run-mode-hooks &rest hookvars | 1148 | @defun run-mode-hooks &rest hookvars |
| 1145 | Major modes should run their mode hook using this function. It is | 1149 | Major modes should run their mode hook using this function. It is |
| 1146 | similar to @code{run-hooks} (@pxref{Hooks}), but if run inside a | 1150 | similar to @code{run-hooks} (@pxref{Hooks}), but it also runs |
| 1147 | @code{delay-mode-hooks} form, this function does not run any hooks. | ||
| 1148 | Instead, it arranges for @var{hookvars} to be run at a later call to | ||
| 1149 | the function. Otherwise, @code{run-mode-hooks} runs any delayed hooks | ||
| 1150 | in order, then @var{hookvars} and finally | ||
| 1151 | @code{after-change-major-mode-hook}. | 1151 | @code{after-change-major-mode-hook}. |
| 1152 | |||
| 1153 | When the call to this function is dynamically inside a | ||
| 1154 | @code{delay-mode-hooks} form, this function does not run any hooks. | ||
| 1155 | Instead, it arranges for the next call to @code{run-mode-hooks} to run | ||
| 1156 | @var{hookvars}. | ||
| 1152 | @end defun | 1157 | @end defun |
| 1153 | 1158 | ||
| 1154 | @defmac delay-mode-hooks body... | 1159 | @defmac delay-mode-hooks body... |
| 1155 | This macro executes @var{body} like @code{progn}, but all calls to | 1160 | This macro executes @var{body} like @code{progn}, but all calls to |
| 1156 | @code{run-mode-hooks} inside @var{body} delay running their hooks. | 1161 | @code{run-mode-hooks} inside @var{body} delay running their hooks. |
| 1157 | They will be run by the first call to @code{run-mode-hooks} after exit | 1162 | They will be run by the first call to @code{run-mode-hooks} after exit |
| 1158 | from @code{delay-mode-hooks}. | 1163 | from @code{delay-mode-hooks}. This is the proper way for a major mode |
| 1164 | command to invoke its parent mode. | ||
| 1159 | @end defmac | 1165 | @end defmac |
| 1160 | 1166 | ||
| 1161 | @defvar after-change-major-mode-hook | 1167 | @defvar after-change-major-mode-hook |
| 1162 | Every major mode function should run this normal hook at its very end. | 1168 | Every major mode function should run this normal hook at its very end. |
| 1163 | It normally does not need to do so explicitly. Indeed, a major mode | 1169 | It normally does not need to do so explicitly. Indeed, a major mode |
| 1164 | function should normally run its mode hook with @code{run-mode-hooks} | 1170 | function should normally run its mode hook with @code{run-mode-hooks} |
| 1165 | as the very last thing it does and @code{run-mode-hooks} runs | 1171 | as the very last thing it does, and the last thing |
| 1166 | @code{after-change-major-mode-hook} at its very end. | 1172 | @code{run-mode-hooks} does is run @code{after-change-major-mode-hook}. |
| 1167 | @end defvar | 1173 | @end defvar |
| 1168 | 1174 | ||
| 1169 | @node Minor Modes | 1175 | @node Minor Modes |