• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/

Lines Matching +defs:save +defs:some +defs:buffers

46 (defcustom delete-auto-save-files t
47 "Non-nil means delete auto-save file when a buffer is saved or killed.
49 Note that the auto-save file will not be deleted if the buffer is killed
52 :group 'auto-save)
144 (defcustom buffer-offer-save nil
145 "Non-nil in a buffer means always offer to save buffer on exit.
147 Automatically local in all buffers."
150 (make-variable-buffer-local 'buffer-offer-save)
153 "Non-nil means find a file under alternative names, in existing buffers.
230 Some modes set this non-nil in particular buffers.
246 When nil, make them for files that have some already.
288 A value of `visit-save' means do it at both of those times.
296 (const :tag "When visiting or saving" visit-save)
309 A value of `visit-save' means do it at both of those times.
315 add a final newline, whenever you save a file that really needs one."
318 (const :tag "When visiting or saving" visit-save)
324 (defcustom auto-save-default t
327 :group 'auto-save)
329 (defcustom auto-save-visited-file-name nil
330 "Non-nil says auto-save a buffer in the file it is visiting, when practical.
331 Normally auto-save files are written under other names."
333 :group 'auto-save)
335 (defcustom auto-save-file-name-transforms
340 "Transforms to apply to buffer file name before making auto-save file name.
345 If the optional element UNIQUIFY is non-nil, the auto-save file name is
355 The default value is set up to put the auto-save file into the
361 :group 'auto-save
366 (defcustom save-abbrevs t
367 "Non-nil means save word abbrevs too when files are saved.
418 to how to save a buffer to file, for instance, choosing a suitable
421 updates before the buffer is saved, use `before-save-hook'.")
445 use `before-save-hook'.")
509 "Non-nil means buffers visiting files read-only do so in view mode.
510 In fact, this means that all read-only buffers normally have
511 View mode enabled, including buffers that are read-only because
512 you visit a file you cannot alter, and buffers you make read-only
619 ;; because otherwise expand-file-name may give some bad results.
804 ;; This is so that ange-ftp can save time by doing a no-op.
821 ;; This is so that ange-ftp can save time by doing a no-op.
832 ;; save time--don't recalculate.
875 (save-match-data
884 ;; embedded .. in some cases such as ./../foo and foo/bar/../../../lose.
900 The returned file name (created by appending some random characters at the end
1188 (save-selected-window
1201 (save-selected-window
1214 for one or more indirect buffers, the other buffer(s) are not
1233 (save-buffer)))
1251 ;; Likewise for dired buffers.
1300 (save-match-data
1314 ;; Compute and save the abbreviated homedir name.
1336 (save-match-data
1345 "List of logical names for which visiting shouldn't save the true dirname.
1357 If PREDICATE is non-nil, only buffers satisfying it are eligible,
1366 (save-excursion
1428 used and expanded, return a list of buffers that are visiting
1552 Do you want to save the file, and visit it literally instead? "
1558 Do you want to save the file, and visit it normally instead? ")
1561 (save-buffer)
1761 exists an auto-save file more recent than the visited file.
1762 NOAUTO means don't mess with auto-save mode.
1783 auto-save-visited-file-name))
1784 (file-newer-than-file-p (or buffer-auto-save-file-name
1785 (make-auto-save-file-name))
1787 (format "%s has auto save data; consider M-x recover-this-file"
1804 (when (and auto-save-default (not noauto))
1805 (auto-save-mode t)))
1820 (and (memq require-final-newline '(visit visit-save))
1825 (save-excursion
1977 ;; some news reader is reported to use this
2020 ;; either user's dot-files or under /etc or some such
2197 (save-excursion
2202 (if (save-excursion (search-forward ":" end t))
2221 ;; If we found modes to use, invoke them now, outside the save-excursion.
2235 (setq mode (save-excursion
2249 (if (setq done (save-excursion
2251 (save-restriction
2297 (if (setq done (save-excursion
2299 (save-restriction
2402 buffer-auto-save-file-name
2450 save-some-buffers-action-alist
2493 (offer-save (and (eq enable-local-variables t) unsafe-vars))
2495 (save-window-excursion
2513 (if offer-save
2533 (if offer-save "y, n, or !" "y or n")
2541 (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g)))
2559 (when (and offer-save (= char ?!) unsafe-vars)
2567 (customize-save-variable
2585 (save-excursion
2608 (val (save-restriction
2641 (save-excursion
2665 (save-excursion
2728 ;; Find those variables that we may want to save to
2855 (save-excursion (eval val)))
2960 (let ((oauto buffer-auto-save-file-name))
2961 ;; If auto-save was not already on, turn it on if appropriate.
2962 (if (not buffer-auto-save-file-name)
2963 (and buffer-file-name auto-save-default
2964 (auto-save-mode t))
2965 ;; If auto save is on, start using a new name.
2966 ;; We deliberately don't rename or delete the old auto save
2968 ;; the user wants to save the new state and then compare with the
2969 ;; previous state from the auto save file.
2970 (setq buffer-auto-save-file-name
2971 (make-auto-save-file-name)))
2972 ;; Rename the old auto save file if any.
2973 (and oauto buffer-auto-save-file-name
2975 (rename-file oauto buffer-auto-save-file-name t)))
3032 (save-buffer)
3066 ;; (error "Cannot save buffer in directory %s" buffer-file-name))
3188 (save-match-data
3211 (save-match-data
3439 ;; (save-match-data
3478 (save-match-data
3521 (defun save-buffer (&optional args)
3526 if previously requested or if this is the first save.
3528 to become a backup when the next save is done.
3532 to become a backup when the next save is done,
3556 See the subroutine `basic-save-buffer' for more information."
3565 (basic-save-buffer)
3568 (defun delete-auto-save-file-if-necessary (&optional force)
3569 "Delete auto-save file for current buffer if `delete-auto-save-files' is t.
3571 the last real save, but optional arg FORCE non-nil means delete anyway."
3572 (and buffer-auto-save-file-name delete-auto-save-files
3573 (not (string= buffer-file-name buffer-auto-save-file-name))
3574 (or force (recent-auto-save-p))
3577 (delete-file buffer-auto-save-file-name)
3581 (defvar auto-save-hook nil
3584 (defcustom before-save-hook nil
3590 (defcustom after-save-hook nil
3596 (defvar save-buffer-coding-system nil
3604 (make-variable-buffer-local 'save-buffer-coding-system)
3605 (put 'save-buffer-coding-system 'permanent-local t)
3607 (defun basic-save-buffer ()
3613 `before-save-hook' and `after-save-hook', respectively."
3615 (save-current-buffer
3616 ;; In an indirect buffer, save its base buffer instead.
3620 (let ((recent-save (recent-auto-save-p))
3627 ;; Strip VMS version number before save.
3639 (read-file-name "File to save in: ") nil)))
3662 (save-restriction
3664 (save-excursion
3671 (eq require-final-newline 'visit-save)
3676 (save-excursion
3680 (vc-before-save)
3681 (run-hooks 'before-save-hook)
3687 (setq setmodes (basic-save-buffer-1)))
3691 (if save-buffer-coding-system
3692 (setq save-buffer-coding-system last-coding-system-used)
3700 ;; If the auto-save file was recent before this command,
3702 (delete-auto-save-file-if-necessary recent-save)
3704 (vc-after-save)
3705 (run-hooks 'after-save-hook))
3712 (defun basic-save-buffer-1 ()
3714 (if save-buffer-coding-system
3715 (let ((coding-system-for-write save-buffer-coding-system))
3716 (basic-save-buffer-2))
3717 (basic-save-buffer-2))
3721 (defun basic-save-buffer-2 ()
3732 (format "File %s is write-protected; try to save anyway? "
3736 (error "Attempt to save to a file which you aren't allowed to write"))))))
3819 (save-restriction
3830 ;; return always nil, so that save-buffers-kill-emacs will not move
3834 (defvar save-some-buffers-action-alist
3845 (save-window-excursion
3854 (defvar buffer-save-without-query nil
3855 "Non-nil means `save-some-buffers' should save this buffer without asking.")
3856 (make-variable-buffer-local 'buffer-save-without-query)
3858 (defun save-some-buffers (&optional arg pred)
3859 "Save some modified file-visiting buffers. Asks user about each one.
3860 You can answer `y' to save, `n' not to save, `C-r' to look at the
3864 Optional argument (the prefix) non-nil means save all with no questions.
3865 Optional second argument PRED determines which buffers are considered:
3866 If PRED is nil, all the file-visiting buffers are considered.
3867 If PRED is t, then certain non-file buffers will also be considered.
3871 See `save-some-buffers-action-alist' if you want to
3874 (save-window-excursion
3875 (let* (queried some-automatic
3878 ;; First save any buffers that we're supposed to save unconditionally.
3881 (when (and buffer-save-without-query (buffer-modified-p))
3882 (setq some-automatic t)
3883 (save-buffer))))
3884 ;; Ask about those buffers that merit it,
3897 (and buffer-offer-save (> (buffer-size) 0)))))
3911 (save-buffer)))
3913 '("buffer" "buffers" "save")
3914 save-some-buffers-action-alist))
3915 ;; Maybe to save abbrevs, and record whether
3917 (and save-abbrevs abbrevs-changed
3920 (eq save-abbrevs 'silently)
3928 (message (if some-automatic
3935 With prefix arg, mark buffer as modified, so \\[save-buffer] will save.
4013 This function is useful for creating multiple shell process buffers
4014 or multiple mail buffers, etc."
4016 (save-match-data
4070 and second, t if reading the auto-save file.
4089 see Info node `(emacs)Supporting additional buffers'.")
4110 With a prefix argument, offer to revert from latest auto-save file, if
4113 This command also works for special buffers that contain text which
4114 doesn't come from a file, but reflects some other data base instead:
4115 for example, Dired buffers and `buffer-list' buffers. In these cases,
4119 to revert from the auto-save file when this is nil. Note that the
4126 revert buffers without querying for confirmation.)
4139 ;; argument should be t to avoid consulting the auto-save file, and
4148 (let* ((auto-save-p (and (not ignore-auto)
4149 (recent-auto-save-p)
4150 buffer-auto-save-file-name
4151 (file-readable-p buffer-auto-save-file-name)
4153 "Buffer has been auto-saved recently. Revert from auto-save file? ")))
4154 (file-name (if auto-save-p
4155 buffer-auto-save-file-name
4170 (and (not auto-save-p)
4187 file-name auto-save-p)))
4202 (or auto-save-p
4208 (if auto-save-p 'auto-save-coding
4229 (insert-file-contents file-name (not auto-save-p)
4231 (insert-file-contents file-name (not auto-save-p)
4248 "Recover the visited file--get contents from its last auto-save file."
4253 "Visit file FILE, but get contents from its last auto-save file."
4259 (if (auto-save-file-name-p (file-name-nondirectory file))
4260 (error "%s is an auto-save file" (abbreviate-file-name file)))
4262 (make-auto-save-file-name))))
4266 (error "Auto-save file %s not current"
4268 ((save-window-excursion
4271 (save-excursion
4278 ;; FILE might not exist if the auto-save file was for
4284 (yes-or-no-p (format "Recover auto save file %s? " file-name)))
4290 (coding-system-for-read 'auto-save-coding))
4298 "Recover auto save files from a previous Emacs session.
4304 (if (null auto-save-list-file-prefix)
4305 (error "You set `auto-save-list-file-prefix' to disable making session files"))
4306 (let ((dir (file-name-directory auto-save-list-file-prefix)))
4312 auto-save-list-file-prefix)))
4316 (dired (concat auto-save-list-file-prefix "*")
4318 (save-excursion
4326 " You can also delete some of these files;\n"
4332 "Choose one saved session to recover auto-save files from.
4343 (save-excursion
4344 ;; Read in the auto-save-list file.
4354 ;; Get the auto-save file name and manufacture
4358 ;; If there is no auto-save file name, the
4359 ;; auto-save-list file is probably corrupted.
4383 ;; Ignore a file if its auto-save file does not exist now.
4390 ;; The second line is the auto-save file name.
4395 (save-excursion (recover-file file))
4403 (defun kill-some-buffers (&optional list)
4404 "Kill some buffers. Asks the user whether to kill each one of them.
4406 specifies the list of buffers to kill, asking for approval for each one."
4426 (defun auto-save-mode (arg)
4430 (setq buffer-auto-save-file-name
4432 (or (not buffer-auto-save-file-name)
4433 ;; If auto-save is off because buffer has shrunk,
4437 (if (and buffer-file-name auto-save-visited-file-name
4440 (make-auto-save-file-name))))
4446 (message "Auto-save %s (in this buffer)"
4447 (if buffer-auto-save-file-name "on" "off")))
4448 buffer-auto-save-file-name)
4450 (defun rename-auto-save-file ()
4451 "Adjust current buffer's auto save file name for current conditions.
4452 Also rename any existing auto save file, if it was made in this session."
4453 (let ((osave buffer-auto-save-file-name))
4454 (setq buffer-auto-save-file-name
4455 (make-auto-save-file-name))
4456 (if (and osave buffer-auto-save-file-name
4457 (not (string= buffer-auto-save-file-name buffer-file-name))
4458 (not (string= buffer-auto-save-file-name osave))
4460 (recent-auto-save-p))
4461 (rename-file osave buffer-auto-save-file-name t))))
4463 (defun make-auto-save-file-name ()
4465 Does not consider `auto-save-visited-file-name' as that variable is checked
4467 See also `auto-save-file-name-p'."
4470 'make-auto-save-file-name)))
4472 (funcall handler 'make-auto-save-file-name)
4473 (let ((list auto-save-file-name-transforms)
4513 ;; Make sure auto-save file names don't contain characters
4521 ;; Deal with buffers that don't have any associated files. (Mail
4562 ;; but we don't want it to exist until we do an auto-save.
4568 (defun auto-save-file-name-p (filename)
4569 "Return non-nil if FILENAME can be yielded by `make-auto-save-file-name'.
4671 (save-match-data
4726 (save-excursion
4746 PATTERN that already quotes some of the special characters."
4747 (save-match-data
4756 ;; Windows shells require that in some cases, such as
4820 (save-match-data
4845 ;; In some locales, month abbreviations are as short as 2 letters,
4975 ;; Quote some characters that have
5010 (save-excursion
5140 (save-restriction
5160 (save-excursion
5197 `save-buffers-kill-emacs' (\\[save-buffers-kill-emacs]) calls these functions,
5211 (defun save-buffers-kill-emacs (&optional arg)
5212 "Offer to save each buffer, then kill this Emacs process.
5213 With prefix arg, silently save all file-visiting buffers, then kill."
5215 (save-some-buffers arg t)
5220 (yes-or-no-p "Modified buffers exist; exit anyway? "))
5300 (save-match-data
5331 (define-key ctl-x-map "\C-s" 'save-buffer)
5332 (define-key ctl-x-map "s" 'save-some-buffers)
5337 (define-key ctl-x-map "\C-c" 'save-buffers-kill-emacs)