Mercurial > hg > xemacs-beta
comparison lisp/prim/files.el @ 193:f53b5ca2e663 r20-3b23
Import from CVS: tag r20-3b23
| author | cvs |
|---|---|
| date | Mon, 13 Aug 2007 09:58:30 +0200 |
| parents | 489f57a838ef |
| children | a2f645c6b9f8 |
comparison
equal
deleted
inserted
replaced
| 192:9d35321dd38c | 193:f53b5ca2e663 |
|---|---|
| 2037 (let ((modp (buffer-modified-p)) | 2037 (let ((modp (buffer-modified-p)) |
| 2038 (large (> (buffer-size) 50000)) | 2038 (large (> (buffer-size) 50000)) |
| 2039 (make-backup-files (or (and make-backup-files (not (eq args 0))) | 2039 (make-backup-files (or (and make-backup-files (not (eq args 0))) |
| 2040 (memq args '(16 64))))) | 2040 (memq args '(16 64))))) |
| 2041 (and modp (memq args '(16 64)) (setq buffer-backed-up nil)) | 2041 (and modp (memq args '(16 64)) (setq buffer-backed-up nil)) |
| 2042 (if (and modp large) (message "Saving file %s..." | 2042 (if (and modp large) (display-message |
| 2043 (buffer-file-name))) | 2043 'progress (format "Saving file %s..." |
| 2044 (buffer-file-name)))) | |
| 2044 (basic-save-buffer) | 2045 (basic-save-buffer) |
| 2045 (and modp (memq args '(4 64)) (setq buffer-backed-up nil)))) | 2046 (and modp (memq args '(4 64)) (setq buffer-backed-up nil)))) |
| 2046 | 2047 |
| 2047 (defun delete-auto-save-file-if-necessary (&optional force) | 2048 (defun delete-auto-save-file-if-necessary (&optional force) |
| 2048 "Delete auto-save file for current buffer if `delete-auto-save-files' is t. | 2049 "Delete auto-save file for current buffer if `delete-auto-save-files' is t. |
| 2172 ;; delete it now. | 2173 ;; delete it now. |
| 2173 (delete-auto-save-file-if-necessary recent-save) | 2174 (delete-auto-save-file-if-necessary recent-save) |
| 2174 ;; Support VC `implicit' locking. | 2175 ;; Support VC `implicit' locking. |
| 2175 (vc-after-save) | 2176 (vc-after-save) |
| 2176 (run-hooks 'after-save-hook)) | 2177 (run-hooks 'after-save-hook)) |
| 2177 (message "(No changes need to be saved)")))) | 2178 (display-message 'no-log "(No changes need to be saved)")))) |
| 2178 | 2179 |
| 2179 ;; This does the "real job" of writing a buffer into its visited file | 2180 ;; This does the "real job" of writing a buffer into its visited file |
| 2180 ;; and making a backup file. This is what is normally done | 2181 ;; and making a backup file. This is what is normally done |
| 2181 ;; but inhibited if one of write-file-hooks returns non-nil. | 2182 ;; but inhibited if one of write-file-hooks returns non-nil. |
| 2182 ;; It returns a value to store in setmodes. | 2183 ;; It returns a value to store in setmodes. |
| 2352 (write-abbrev-file nil)) | 2353 (write-abbrev-file nil)) |
| 2353 ;; Don't keep bothering user if he says no. | 2354 ;; Don't keep bothering user if he says no. |
| 2354 (setq abbrevs-changed nil) | 2355 (setq abbrevs-changed nil) |
| 2355 t)))) | 2356 t)))) |
| 2356 (or (> files-done 0) abbrevs-done | 2357 (or (> files-done 0) abbrevs-done |
| 2357 (message "(No files need saving)")))))) | 2358 (display-message 'no-log "(No files need saving)")))))) |
| 2358 | 2359 |
| 2359 | 2360 |
| 2360 (defun not-modified (&optional arg) | 2361 (defun not-modified (&optional arg) |
| 2361 "Mark current buffer as unmodified, not needing to be saved. | 2362 "Mark current buffer as unmodified, not needing to be saved. |
| 2362 With prefix arg, mark buffer as modified, so \\[save-buffer] will save. | 2363 With prefix arg, mark buffer as modified, so \\[save-buffer] will save. |
| 2363 | 2364 |
| 2364 It is not a good idea to use this function in Lisp programs, because it | 2365 It is not a good idea to use this function in Lisp programs, because it |
| 2365 prints a message in the minibuffer. Instead, use `set-buffer-modified-p'." | 2366 prints a message in the minibuffer. Instead, use `set-buffer-modified-p'." |
| 2366 (interactive "_P") | 2367 (interactive "_P") |
| 2367 (if arg ;; rewritten for I18N3 snarfing | 2368 (if arg ;; rewritten for I18N3 snarfing |
| 2368 (message "Modification-flag set") | 2369 (display-message 'command "Modification-flag set") |
| 2369 (message "Modification-flag cleared")) | 2370 (display-message 'command "Modification-flag cleared")) |
| 2370 (set-buffer-modified-p arg)) | 2371 (set-buffer-modified-p arg)) |
| 2371 | 2372 |
| 2372 (defun toggle-read-only (&optional arg) | 2373 (defun toggle-read-only (&optional arg) |
| 2373 "Change whether this buffer is visiting its file read-only. | 2374 "Change whether this buffer is visiting its file read-only. |
| 2374 With arg, set read-only iff arg is positive." | 2375 With arg, set read-only iff arg is positive." |
| 2783 ;; turn it back on. | 2784 ;; turn it back on. |
| 2784 (and (< buffer-saved-size 0) | 2785 (and (< buffer-saved-size 0) |
| 2785 (setq buffer-saved-size 0)) | 2786 (setq buffer-saved-size 0)) |
| 2786 (if (interactive-p) | 2787 (if (interactive-p) |
| 2787 (if buffer-auto-save-file-name ;; rewritten for I18N3 snarfing | 2788 (if buffer-auto-save-file-name ;; rewritten for I18N3 snarfing |
| 2788 (message "Auto-save on (in this buffer)") | 2789 (display-message 'command "Auto-save on (in this buffer)") |
| 2789 (message "Auto-save off (in this buffer)"))) | 2790 (display-message 'command "Auto-save off (in this buffer)"))) |
| 2790 buffer-auto-save-file-name) | 2791 buffer-auto-save-file-name) |
| 2791 | 2792 |
| 2792 (defun rename-auto-save-file () | 2793 (defun rename-auto-save-file () |
| 2793 "Adjust current buffer's auto save file name for current conditions. | 2794 "Adjust current buffer's auto save file name for current conditions. |
| 2794 Also rename any existing auto save file, if it was made in this session." | 2795 Also rename any existing auto save file, if it was made in this session." |
