comparison lispref/files.texi @ 56322:f597c982349e

(Saving Buffers): Cleanup write-contents-function. (Magic File Names): Cleanup file-remote-p.
author Richard M. Stallman <rms@gnu.org>
date Fri, 02 Jul 2004 23:43:50 +0000
parents 904bb1836ccd
children 54f19dd158e9 6f6e9fe4658b
comparison
equal deleted inserted replaced
56321:904bb1836ccd 56322:f597c982349e
413 @code{remove-hook} to manipulate the list. @xref{Hooks}. 413 @code{remove-hook} to manipulate the list. @xref{Hooks}.
414 @end defvar 414 @end defvar
415 415
416 @c Emacs 19 feature 416 @c Emacs 19 feature
417 @defvar write-contents-functions 417 @defvar write-contents-functions
418 This works just like @code{write-file-functions}, but it is intended for 418 This works just like @code{write-file-functions}, but it is intended
419 hooks that pertain to the contents of the file, as opposed to hooks that 419 for hooks that pertain to the buffer's contents, not to the particular
420 pertain to the file's name or location. Such hooks are usually set up by 420 visited file or its location. Such hooks are usually set up by major
421 major modes, as buffer-local bindings for this variable. If any of the 421 modes, as buffer-local bindings for this variable. This variable
422 functions in this hook returns non-@code{nil}, the file is considered 422 automatically becomes buffer-local whenever it is set; switching to a
423 already written and the rest are not called and neither are the functions 423 new major mode always resets this variable, but calling
424 in @code{write-file-functions}. 424 @code{set-visited-file-name} does not.
425 425
426 This variable automatically becomes buffer-local whenever it is set; 426 If any of the functions in this hook returns non-@code{nil}, the file
427 switching to a new major mode always resets this variable, but 427 is considered already written and the rest are not called and neither
428 calling @code{set-visited-file-name} does not. 428 are the functions in @code{write-file-functions}.
429 @end defvar 429 @end defvar
430 430
431 @defopt before-save-hook 431 @defopt before-save-hook
432 This normal hook runs before a buffer is saved in its visited file, 432 This normal hook runs before a buffer is saved in its visited file,
433 regardless of whether that is done normally or by one of the hooks 433 regardless of whether that is done normally or by one of the hooks
2644 nothing and returns @code{nil}. Otherwise it returns the file name 2644 nothing and returns @code{nil}. Otherwise it returns the file name
2645 of the local copy file. 2645 of the local copy file.
2646 @end defun 2646 @end defun
2647 2647
2648 @defun file-remote-p filename 2648 @defun file-remote-p filename
2649 This function tests whether @var{filename} is a remote file. The 2649 This function tests whether @var{filename} is a remote file. If
2650 return value is an identifier of the remote system, if @var{filename} 2650 @var{filename} is local (not remote), the return value is @code{nil}.
2651 is indeed remote. Besides the host name, the identifier may comprise 2651 If @var{filename} is indeed remote, the return value is a string that
2652 a user name and a method used to access that system. 2652 identifies the remote system.
2653 2653
2654 To illustrate, for the filename @code{/ssh:user@@host:/some/file}, the 2654 This identifier string may include a host name, a user name, and
2655 identifier is @code{/ssh:user@@host:}. 2655 characters designating the method used to access the remote system.
2656 2656 For example, the remote identifier string for the filename
2657 If @var{filename} is local (not remote), then the return value is 2657 @code{/ssh:user@@host:/some/file} is @code{/ssh:user@@host:}.
2658 @code{nil}.
2659 2658
2660 If @code{file-remote-p} returns the same identifier for two different 2659 If @code{file-remote-p} returns the same identifier for two different
2661 filenames, then the file handler is the same, and also the files can 2660 filenames, that means they are stored on the same file system and can
2662 be accessed locally with respect to each other. This means, for 2661 be accessed locally with respect to each other. This means, for
2663 example, that it is possible to start a (remote) process accessing 2662 example, that it is possible to start a remote process accessing both
2664 both files at the same time. Implementors of file handlers need to 2663 files at the same time. Implementors of file handlers need to ensure
2665 ensure this. 2664 this principle is valid.
2666 @end defun 2665 @end defun
2667 2666
2668 @defun unhandled-file-name-directory filename 2667 @defun unhandled-file-name-directory filename
2669 This function returns the name of a directory that is not magic. It 2668 This function returns the name of a directory that is not magic. It
2670 uses the directory part of @var{filename} if that is not magic. For a 2669 uses the directory part of @var{filename} if that is not magic. For a