*** empty log message ***
This commit is contained in:
parent
5ef6a86d2e
commit
f2aa473a2c
10 changed files with 78 additions and 62 deletions
1
etc/NEWS
1
etc/NEWS
|
@ -884,6 +884,7 @@ mode-lines in inverse-video.
|
|||
|
||||
* Lisp Changes in Emacs 21.4
|
||||
|
||||
+++
|
||||
** Renamed file hooks to follow the convention:
|
||||
find-file-hooks to find-file-hook,
|
||||
find-file-not-found-hooks to find-file-not-found-functions,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
2002-06-23 Stefan Monnier <monnier@cs.yale.edu>
|
||||
|
||||
* subr.el (event-start, event-end, event-click-count):
|
||||
Accept non-mouse events as well.
|
||||
(read-key): New function.
|
||||
(read-quoted-char): Use it. Use this-single-command-raw-keys as well.
|
||||
|
||||
* files.el: Rename (and mark as obsolete)
|
||||
find-file-hooks to find-file-hook,
|
||||
find-file-not-found-hooks to find-file-not-found-functions,
|
||||
write-file-hooks to write-file-functions,
|
||||
write-contents-hooks to write-contents-functions.
|
||||
Mark local-write-file-hooks as obsolete.
|
||||
(locate-file-completion): Don't cons uselessly. Use test-completion.
|
||||
(basic-save-buffer): Use (point-min) rather than 1.
|
||||
(basic-save-buffer-2): Obey the `setmodes' returned by backup-buffer.
|
||||
|
||||
* help-fns.el (describe-variable): Only use `buffer' is still live.
|
||||
Use `delete-region' instead of save-excursion + delete-char.
|
||||
Document the obsolescence of the variable, if applicable.
|
||||
|
||||
2002-06-23 Glenn Morris <gmorris@ast.cam.ac.uk>
|
||||
|
||||
* progmodes/f90.el (f90-do-auto-fill): Respect the value of
|
||||
|
|
|
@ -141,11 +141,11 @@ The @code{find-file-noselect} function normally calls
|
|||
Visiting}). That function sets the buffer major mode, parses local
|
||||
variables, warns the user if there exists an auto-save file more recent
|
||||
than the file just visited, and finishes by running the functions in
|
||||
@code{find-file-hooks}.
|
||||
@code{find-file-hook}.
|
||||
|
||||
If the optional argument @var{rawfile} is non-@code{nil}, then
|
||||
@code{after-find-file} is not called, and the
|
||||
@code{find-file-not-found-hooks} are not run in case of failure. What's
|
||||
@code{find-file-not-found-functions} are not run in case of failure. What's
|
||||
more, a non-@code{nil} @var{rawfile} value suppresses coding system
|
||||
conversion (@pxref{Coding Systems}) and format conversion (@pxref{Format
|
||||
Conversion}).
|
||||
|
@ -200,7 +200,7 @@ match them. If this is @code{nil}, then wildcard characters are
|
|||
not treated specially.
|
||||
@end defvar
|
||||
|
||||
@defvar find-file-hooks
|
||||
@defvar find-file-hook
|
||||
The value of this variable is a list of functions to be called after a
|
||||
file is visited. The file's local-variables specification (if any) will
|
||||
have been processed before the hooks are run. The buffer visiting the
|
||||
|
@ -210,7 +210,7 @@ This variable works just like a normal hook, but we think that renaming
|
|||
it would not be advisable. @xref{Hooks}.
|
||||
@end defvar
|
||||
|
||||
@defvar find-file-not-found-hooks
|
||||
@defvar find-file-not-found-functions
|
||||
The value of this variable is a list of functions to be called when
|
||||
@code{find-file} or @code{find-file-noselect} is passed a nonexistent
|
||||
file name. @code{find-file-noselect} calls these functions as soon as
|
||||
|
@ -285,11 +285,11 @@ of this variable.
|
|||
|
||||
If @var{nomodes} is non-@code{nil}, that means don't alter the buffer's
|
||||
major mode, don't process local variables specifications in the file,
|
||||
and don't run @code{find-file-hooks}. This feature is used by
|
||||
and don't run @code{find-file-hook}. This feature is used by
|
||||
@code{revert-buffer} in some cases.
|
||||
|
||||
The last thing @code{after-find-file} does is call all the functions
|
||||
in the list @code{find-file-hooks}.
|
||||
in the list @code{find-file-hook}.
|
||||
@end defun
|
||||
|
||||
@node Saving Buffers
|
||||
|
@ -362,14 +362,14 @@ before overwriting an existing file.
|
|||
conversion (@pxref{Format Conversion}), and may save text properties in
|
||||
``annotations'' (@pxref{Saving Properties}).
|
||||
|
||||
@defvar write-file-hooks
|
||||
@defvar write-file-functions
|
||||
The value of this variable is a list of functions to be called before
|
||||
writing out a buffer to its visited file. If one of them returns
|
||||
non-@code{nil}, the file is considered already written and the rest of
|
||||
the functions are not called, nor is the usual code for writing the file
|
||||
executed.
|
||||
|
||||
If a function in @code{write-file-hooks} returns non-@code{nil}, it
|
||||
If a function in @code{write-file-functions} returns non-@code{nil}, it
|
||||
is responsible for making a backup file (if that is appropriate).
|
||||
To do so, execute the following code:
|
||||
|
||||
|
@ -381,43 +381,33 @@ You might wish to save the file modes value returned by
|
|||
@code{backup-buffer} and use that to set the mode bits of the file that
|
||||
you write. This is what @code{save-buffer} normally does.
|
||||
|
||||
The hook functions in @code{write-file-hooks} are also responsible for
|
||||
The hook functions in @code{write-file-functions} are also responsible for
|
||||
encoding the data (if desired): they must choose a suitable coding
|
||||
system (@pxref{Lisp and Coding Systems}), perform the encoding
|
||||
(@pxref{Explicit Encoding}), and set @code{last-coding-system-used} to
|
||||
the coding system that was used (@pxref{Encoding and I/O}).
|
||||
|
||||
Do not make this variable buffer-local. To set up buffer-specific hook
|
||||
functions, use @code{write-contents-hooks} instead.
|
||||
If you set this hook locally in a buffer, it is assumed to be
|
||||
associated with the file or the way the contents of the buffer were
|
||||
obtained. Thus the variable is marked as a permanent local, so that
|
||||
changing the major mode does not alter a buffer-local value. On the
|
||||
other hand, calling @code{set-visited-file-name} will reset it.
|
||||
If this is not what you want, you might like to use
|
||||
@code{write-contents-functions} instead.
|
||||
|
||||
Even though this is not a normal hook, you can use @code{add-hook} and
|
||||
@code{remove-hook} to manipulate the list. @xref{Hooks}.
|
||||
@end defvar
|
||||
|
||||
@c Emacs 19 feature
|
||||
@defvar local-write-file-hooks
|
||||
This works just like @code{write-file-hooks}, but it is intended to be
|
||||
made buffer-local in particular buffers, and used for hooks that pertain
|
||||
to the file name or the way the buffer contents were obtained.
|
||||
|
||||
The variable is marked as a permanent local, so that changing the major
|
||||
mode does not alter a buffer-local value. This is convenient for
|
||||
packages that read ``file'' contents in special ways, and set up hooks
|
||||
to save the data in a corresponding way.
|
||||
@end defvar
|
||||
|
||||
@c Emacs 19 feature
|
||||
@defvar write-contents-hooks
|
||||
This works just like @code{write-file-hooks}, but it is intended for
|
||||
@defvar write-contents-functions
|
||||
This works just like @code{write-file-functions}, but it is intended for
|
||||
hooks that pertain to the contents of the file, as opposed to hooks that
|
||||
pertain to where the file came from. Such hooks are usually set up by
|
||||
major modes, as buffer-local bindings for this variable.
|
||||
|
||||
This variable automatically becomes buffer-local whenever it is set;
|
||||
switching to a new major mode always resets this variable. When you use
|
||||
@code{add-hooks} to add an element to this hook, you should @emph{not}
|
||||
specify a non-@code{nil} @var{local} argument, since this variable is
|
||||
used @emph{only} buffer-locally.
|
||||
switching to a new major mode always resets this variable.
|
||||
@end defvar
|
||||
|
||||
@c Emacs 19 feature
|
||||
|
@ -514,7 +504,7 @@ with @code{insert-file-contents}, as long as @var{replace} and
|
|||
This function works like @code{insert-file-contents} except that it does
|
||||
not do format decoding (@pxref{Format Conversion}), does not do
|
||||
character code conversion (@pxref{Coding Systems}), does not run
|
||||
@code{find-file-hooks}, does not perform automatic uncompression, and so
|
||||
@code{find-file-hook}, does not perform automatic uncompression, and so
|
||||
on.
|
||||
@end defun
|
||||
|
||||
|
|
|
@ -67,8 +67,8 @@ however, we have renamed all of those.)
|
|||
@item electric-command-history-hook
|
||||
@item electric-help-mode-hook
|
||||
@item emacs-lisp-mode-hook
|
||||
@item find-file-hooks
|
||||
@item find-file-not-found-hooks
|
||||
@item find-file-hook
|
||||
@item find-file-not-found-functions
|
||||
@item first-change-hook
|
||||
@item fortran-comment-hook
|
||||
@item fortran-mode-hook
|
||||
|
@ -85,7 +85,6 @@ however, we have renamed all of those.)
|
|||
@item lisp-interaction-mode-hook
|
||||
@item lisp-mode-hook
|
||||
@item list-diary-entries-hook
|
||||
@item local-write-file-hooks
|
||||
@item mail-mode-hook
|
||||
@item mail-setup-hook
|
||||
@item mark-diary-entries-hook
|
||||
|
@ -133,7 +132,7 @@ however, we have renamed all of those.)
|
|||
@item window-scroll-functions
|
||||
@item window-setup-hook
|
||||
@item window-size-change-functions
|
||||
@item write-contents-hooks
|
||||
@item write-file-hooks
|
||||
@item write-contents-functions
|
||||
@item write-file-functions
|
||||
@item write-region-annotate-functions
|
||||
@end table
|
||||
|
|
|
@ -637,7 +637,7 @@ The compiler ignores the @code{provide}, then processes the
|
|||
execute the @code{provide} call, so the subsequent @code{require} call
|
||||
does nothing when the file is loaded.
|
||||
|
||||
@defun provide feature
|
||||
@defun provide feature &optional subfeatures
|
||||
This function announces that @var{feature} is now loaded, or being
|
||||
loaded, into the current Emacs session. This means that the facilities
|
||||
associated with @var{feature} are or will be available for other Lisp
|
||||
|
@ -648,6 +648,9 @@ the front of the list @code{features} if it is not already in the list.
|
|||
The argument @var{feature} must be a symbol. @code{provide} returns
|
||||
@var{feature}.
|
||||
|
||||
If provided, @var{subfeatures} should be a list of symbols indicating
|
||||
a set of specific subfeatures provided by this version of @var{feature}.
|
||||
|
||||
@smallexample
|
||||
features
|
||||
@result{} (bar bish)
|
||||
|
@ -681,10 +684,13 @@ signals an error, @samp{Required feature @var{feature} was not
|
|||
provided}, unless @var{noerror} is non-@code{nil}.
|
||||
@end defun
|
||||
|
||||
@defun featurep feature
|
||||
@defun featurep feature &optional subfeature
|
||||
This function returns @code{t} if @var{feature} has been provided in the
|
||||
current Emacs session (i.e., if @var{feature} is a member of
|
||||
@code{features}.)
|
||||
@code{features}.) If @var{subfeature} is non-nil, then the function
|
||||
returns @code{t} only if that subfeature is provided as well (i.e.
|
||||
if @var{subfeature} is a member of the @var{subfeature} property
|
||||
of the @var{feature} symbol.)
|
||||
@end defun
|
||||
|
||||
@defvar features
|
||||
|
@ -796,10 +802,13 @@ This function arranges to evaluate @var{form} at the end of loading the
|
|||
library @var{library}, if and when @var{library} is loaded. If
|
||||
@var{library} is already loaded, it evaluates @var{form} right away.
|
||||
|
||||
The library name @var{library} must exactly match the argument of
|
||||
@code{load}. To get the proper results when an installed library is
|
||||
found by searching @code{load-path}, you should not include any
|
||||
directory names in @var{library}.
|
||||
If @var{library} is a string, it must exactly match the argument of
|
||||
@code{load} used to load the library. To get the proper results when an
|
||||
installed library is found by searching @code{load-path}, you should not
|
||||
include any directory names in @var{library}.
|
||||
|
||||
@var{library} can also be a feature (i.e. a symbol), in which case,
|
||||
@var{form} is evaluated when @code{(provide @var{library})} is called.
|
||||
|
||||
An error in @var{form} does not undo the load, but does prevent
|
||||
execution of the rest of @var{form}.
|
||||
|
|
|
@ -108,9 +108,6 @@ use, but we don't try to list them all here.
|
|||
@item local-abbrev-table
|
||||
@xref{Abbrevs}.
|
||||
|
||||
@item local-write-file-hooks
|
||||
@xref{Saving Buffers}.
|
||||
|
||||
@item major-mode
|
||||
@xref{Mode Help}.
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ certain contexts. For example an escaped character stands for itself.
|
|||
the buffer. The main application for this function, as its name suggests,
|
||||
is to have it be called automatically every time an empty, and only an
|
||||
empty file is visited. This is accomplished by putting @code{(add-hook
|
||||
'find-file-hooks 'auto-insert)} into your @file{~/.emacs} file
|
||||
'find-file-hook 'auto-insert)} into your @file{~/.emacs} file
|
||||
(@pxref{(emacs)Init File}).
|
||||
|
||||
@vindex auto-insert-alist
|
||||
|
@ -473,7 +473,7 @@ that is updated too.
|
|||
|
||||
An interesting application for this function is to have it be called
|
||||
automatically every time a file is saved. This is accomplished by putting
|
||||
@code{(add-hook 'write-file-hooks 'copyright-update)} into your @file{~/.emacs}
|
||||
@code{(add-hook 'write-file-functions 'copyright-update)} into your @file{~/.emacs}
|
||||
file (@pxref{(emacs)Init File}).
|
||||
|
||||
@vindex copyright-query
|
||||
|
@ -481,7 +481,7 @@ file (@pxref{(emacs)Init File}).
|
|||
copyright or whether to ask about it. When this is @code{nil} updating is
|
||||
only done with @kbd{M-x copyright-update}. When this is @code{function}
|
||||
you are queried whenever @code{copyright-update} is called as a function,
|
||||
such as in the @code{write-file-hooks} feature mentioned above. Otherwise
|
||||
such as in the @code{write-file-functions} feature mentioned above. Otherwise
|
||||
you are always queried.
|
||||
|
||||
|
||||
|
@ -538,10 +538,10 @@ The ``interpreter'' used is @code{executable-self-display} with argument
|
|||
@cindex timestamps
|
||||
|
||||
@findex time-stamp
|
||||
@vindex write-file-hooks
|
||||
@vindex write-file-functions
|
||||
The @code{time-stamp} command can be used to update automatically a
|
||||
template in a file with a new time stamp every time you save the file.
|
||||
Customize the hook @code{write-file-hooks} to add the function
|
||||
Customize the hook @code{write-file-functions} to add the function
|
||||
@code{time-stamp} to arrange this.
|
||||
|
||||
@vindex time-stamp-active
|
||||
|
|
|
@ -744,7 +744,7 @@ in @samp{-hooks} or @samp{-functions}, instead of @samp{-hook}. What
|
|||
makes these hooks abnormal is that there is something peculiar about the
|
||||
way its functions are called---perhaps they are given arguments, or
|
||||
perhaps the values they return are used in some way. For example,
|
||||
@code{find-file-not-found-hooks} (@pxref{Visiting}) is abnormal because
|
||||
@code{find-file-not-found-functions} (@pxref{Visiting}) is abnormal because
|
||||
as soon as one hook function returns a non-@code{nil} value, the rest
|
||||
are not called at all. The documentation of each abnormal hook variable
|
||||
explains in detail what is peculiar about it.
|
||||
|
|
|
@ -320,21 +320,20 @@ does not add a final newline because of @code{require-final-newline}.
|
|||
If you already have visited the same file in the usual (non-literal)
|
||||
manner, this command asks you whether to visit it literally instead.
|
||||
|
||||
@vindex find-file-hooks
|
||||
@vindex find-file-not-found-hooks
|
||||
@vindex find-file-hook
|
||||
@vindex find-file-not-found-functions
|
||||
Two special hook variables allow extensions to modify the operation of
|
||||
visiting files. Visiting a file that does not exist runs the functions
|
||||
in the list @code{find-file-not-found-hooks}; this variable holds a list
|
||||
in the list @code{find-file-not-found-functions}; this variable holds a list
|
||||
of functions, and the functions are called one by one (with no
|
||||
arguments) until one of them returns non-@code{nil}. This is not a
|
||||
normal hook, and the name ends in @samp{-hooks} rather than @samp{-hook}
|
||||
normal hook, and the name ends in @samp{-functions} rather than @samp{-hook}
|
||||
to indicate that fact.
|
||||
|
||||
Successful visiting of any file, whether existing or not, calls the
|
||||
functions in the list @code{find-file-hooks}, with no arguments.
|
||||
This variable is really a normal hook, but it has an abnormal name for
|
||||
historical compatibility. In the case of a nonexistent file, the
|
||||
@code{find-file-not-found-hooks} are run first. @xref{Hooks}.
|
||||
functions in the list @code{find-file-hook}, with no arguments.
|
||||
This variable is a normal hook. In the case of a nonexistent file, the
|
||||
@code{find-file-not-found-functions} are run first. @xref{Hooks}.
|
||||
|
||||
There are several ways to specify automatically the major mode for
|
||||
editing the file (@pxref{Choosing Modes}), and to specify local
|
||||
|
@ -832,7 +831,7 @@ Time-stamp: ""
|
|||
@end example
|
||||
|
||||
Then add the hook function @code{time-stamp} to the hook
|
||||
@code{write-file-hooks}; that hook function will automatically update
|
||||
@code{write-file-functions}; that hook function will automatically update
|
||||
the time stamp, inserting the current date and time when you save the
|
||||
file. You can also use the command @kbd{M-x time-stamp} to update the
|
||||
time stamp manually. For other customizations, see the Custom group
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
@c Version values, for easy modification
|
||||
@c NOTE: The 'UPDATED' value is updated by the 'time-stamp' function.
|
||||
@c If you change it by hand, the modifications will not stay.
|
||||
@set VERSION $Revision: 1.1 $
|
||||
@set VERSION $Revision: 1.2 $
|
||||
@set UPDATED Monday, 17 June, 2002
|
||||
|
||||
|
||||
|
@ -1618,7 +1618,7 @@ mailing list.
|
|||
@c host and then send commands to it.
|
||||
|
||||
@c Local Variables:
|
||||
@c eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
@c eval: (add-hook 'write-file-functions 'time-stamp)
|
||||
@c time-stamp-start: "@set UPDATED "
|
||||
@c time-stamp-format: "%:a, %:d %:b, %:y"
|
||||
@c time-stamp-end: "$"
|
||||
|
|
Loading…
Add table
Reference in a new issue