Mercurial > emacs
comparison lispref/backups.texi @ 12098:a6eb5f12b0f3
*** empty log message ***
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Tue, 06 Jun 1995 19:21:15 +0000 |
parents | 6e1c2ecf280b |
children | 66d807bdc5b4 |
comparison
equal
deleted
inserted
replaced
12097:d8c035332be8 | 12098:a6eb5f12b0f3 |
---|---|
63 up when it is next saved (if backups are enabled). This is a | 63 up when it is next saved (if backups are enabled). This is a |
64 permanent local; @code{kill-local-variables} does not alter it. | 64 permanent local; @code{kill-local-variables} does not alter it. |
65 @end defvar | 65 @end defvar |
66 | 66 |
67 @defopt make-backup-files | 67 @defopt make-backup-files |
68 This variable determines whether or not to make backup files. If it | 68 This variable determines whether or not to make backup files. If it |
69 is non-@code{nil}, then Emacs creates a backup of each file when it is | 69 is non-@code{nil}, then Emacs creates a backup of each file when it is |
70 saved for the first time. | 70 saved for the first time---provided that @code{backup-inhibited} |
71 | 71 is @code{nil} (see below). |
72 The following example shows how to change the @code{make-backup-files} | 72 |
73 The following example shows how to change the @code{make-backup-files} | |
73 variable only in the @file{RMAIL} buffer and not elsewhere. Setting it | 74 variable only in the @file{RMAIL} buffer and not elsewhere. Setting it |
74 @code{nil} stops Emacs from making backups of the @file{RMAIL} file, | 75 @code{nil} stops Emacs from making backups of the @file{RMAIL} file, |
75 which may save disk space. (You would put this code in your | 76 which may save disk space. (You would put this code in your |
76 @file{.emacs} file.) | 77 @file{.emacs} file.) |
77 | 78 |
105 | 106 |
106 @defvar backup-inhibited | 107 @defvar backup-inhibited |
107 If this variable is non-@code{nil}, backups are inhibited. It records | 108 If this variable is non-@code{nil}, backups are inhibited. It records |
108 the result of testing @code{backup-enable-predicate} on the visited file | 109 the result of testing @code{backup-enable-predicate} on the visited file |
109 name. It can also coherently be used by other mechanisms that inhibit | 110 name. It can also coherently be used by other mechanisms that inhibit |
110 backups based on which file is visited. This is a permanent local, | 111 backups based on which file is visited. For example, VC sets this |
111 so that changing the major mode does not lose its value. | 112 variable non-@code{nil} to prevent making backups for files managed |
112 | 113 with a version control system. |
113 Major modes should not set this variable---they should set | 114 |
115 This is a permanent local, so that changing the major mode does not lose | |
116 its value. Major modes should not set this variable---they should set | |
114 @code{make-backup-files} instead. | 117 @code{make-backup-files} instead. |
115 @end defvar | 118 @end defvar |
116 | 119 |
117 @node Rename or Copy | 120 @node Rename or Copy |
118 @subsection Backup by Renaming or by Copying? | 121 @subsection Backup by Renaming or by Copying? |
504 @defopt auto-save-default | 507 @defopt auto-save-default |
505 If this variable is non-@code{nil}, buffers that are visiting files | 508 If this variable is non-@code{nil}, buffers that are visiting files |
506 have auto-saving enabled by default. Otherwise, they do not. | 509 have auto-saving enabled by default. Otherwise, they do not. |
507 @end defopt | 510 @end defopt |
508 | 511 |
509 @deffn Command do-auto-save &optional no-message | 512 @deffn Command do-auto-save &optional no-message current-only |
510 This function auto-saves all buffers that need to be auto-saved. It | 513 This function auto-saves all buffers that need to be auto-saved. It |
511 saves all buffers for which auto-saving is enabled and that have been | 514 saves all buffers for which auto-saving is enabled and that have been |
512 changed since the previous auto-save. | 515 changed since the previous auto-save. |
513 | 516 |
514 Normally, if any buffers are auto-saved, a message that says | 517 Normally, if any buffers are auto-saved, a message that says |
515 @samp{Auto-saving...} is displayed in the echo area while auto-saving is | 518 @samp{Auto-saving...} is displayed in the echo area while auto-saving is |
516 going on. However, if @var{no-message} is non-@code{nil}, the message | 519 going on. However, if @var{no-message} is non-@code{nil}, the message |
517 is inhibited. | 520 is inhibited. |
521 | |
522 If @var{current-only} is non-@code{nil}, only the current buffer | |
523 is auto-saved. | |
518 @end deffn | 524 @end deffn |
519 | 525 |
520 @defun delete-auto-save-file-if-necessary | 526 @defun delete-auto-save-file-if-necessary |
521 This function deletes the current buffer's auto-save file if | 527 This function deletes the current buffer's auto-save file if |
522 @code{delete-auto-save-files} is non-@code{nil}. It is called every | 528 @code{delete-auto-save-files} is non-@code{nil}. It is called every |
543 used to detect a substantial decrease in size, and turn off auto-saving | 549 used to detect a substantial decrease in size, and turn off auto-saving |
544 in response. | 550 in response. |
545 | 551 |
546 If it is -1, that means auto-saving is temporarily shut off in this | 552 If it is -1, that means auto-saving is temporarily shut off in this |
547 buffer due to a substantial deletion. Explicitly saving the buffer | 553 buffer due to a substantial deletion. Explicitly saving the buffer |
548 stores a positive value in this variable, thus reenabling auto-save. | 554 stores a positive value in this variable, thus reenabling auto-saving. |
549 Turning auto-save mode off or on also alters this variable. | 555 Turning auto-save mode off or on also alters this variable. |
550 @end defvar | 556 @end defvar |
551 | 557 |
552 @defvar auto-save-list-file-name | 558 @defvar auto-save-list-file-name |
553 This variable (if non-@code{nil}) specifies a file for recording the | 559 This variable (if non-@code{nil}) specifies a file for recording the |
554 names of all the auto-save files. Each time Emacs does auto-saving, it | 560 names of all the auto-save files. Each time Emacs does auto-saving, it |
555 writes into this file the names of all the auto-save files of all the | 561 writes two lines into this file for each buffer that has auto-saving |
556 buffers that have auto-save enabled. If Emacs crashes, you can look in | 562 enabled. The first line gives the name of the visited file (it's empty |
557 this file to find all the auto-save files that might contain work that | 563 if the buffer has none), and the second gives the name of the auto-save |
558 was otherwise lost. The @code{multi-replace} command uses these files. | 564 file. |
565 | |
566 If Emacs exits normally, it deletes this file. If Emacs crashes, you | |
567 can look in the file to find all the auto-save files that might contain | |
568 work that was otherwise lost. The @code{recover-session} command uses | |
569 these files. | |
559 | 570 |
560 The default name for this file is in your home directory and starts with | 571 The default name for this file is in your home directory and starts with |
561 @samp{.saves-}. It also contains the Emacs process @sc{id} and the host | 572 @samp{.saves-}. It also contains the Emacs process @sc{id} and the host |
562 name. | 573 name. |
563 @end defvar | 574 @end defvar |
610 regenerate the contents. | 621 regenerate the contents. |
611 @end defvar | 622 @end defvar |
612 | 623 |
613 @defvar revert-buffer-insert-file-contents-function | 624 @defvar revert-buffer-insert-file-contents-function |
614 The value of this variable, if non-@code{nil}, is the function to use to | 625 The value of this variable, if non-@code{nil}, is the function to use to |
615 insert contents when reverting this buffer. The function receives two | 626 insert the updated contents when reverting this buffer. The function |
616 arguments, first the file name to use; second, @code{t} if the user has | 627 receives two arguments: first the file name to use; second, @code{t} if |
617 asked to read the auto-save file. | 628 the user has asked to read the auto-save file. |
618 @end defvar | 629 @end defvar |
619 | 630 |
620 @defvar before-revert-hook | 631 @defvar before-revert-hook |
621 This normal hook is run by @code{revert-buffer} before actually | 632 This normal hook is run by @code{revert-buffer} before actually |
622 inserting the modified contents---but only if | 633 inserting the modified contents---but only if |
633 | 644 |
634 Font Lock mode uses this hook to recompute the fonts for the updated | 645 Font Lock mode uses this hook to recompute the fonts for the updated |
635 buffer contents. | 646 buffer contents. |
636 @end defvar | 647 @end defvar |
637 | 648 |
638 @deffn Command recover-file filename | |
639 This function visits @var{filename}, but gets the contents from its | |
640 last auto-save file. This is useful after the system has crashed, to | |
641 resume editing the same file without losing all the work done in the | |
642 previous session. | |
643 | |
644 An error is signaled if there is no auto-save file for @var{filename}, | |
645 or if @var{filename} is newer than its auto-save file. If | |
646 @var{filename} does not exist, but its auto-save file does, then the | |
647 auto-save file is read as usual. This last situation may occur if you | |
648 visited a nonexistent file and never actually saved it. | |
649 @end deffn | |
650 |