Mercurial > hg > xemacs-beta
comparison lisp/files.el @ 286:57709be46d1b r21-0b41
Import from CVS: tag r21-0b41
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:35:03 +0200 |
parents | 558f606b08ae |
children | e11d67e05968 |
comparison
equal
deleted
inserted
replaced
285:9a3756523c1b | 286:57709be46d1b |
---|---|
2394 Optional argument (the prefix) non-nil means save all with no questions. | 2394 Optional argument (the prefix) non-nil means save all with no questions. |
2395 Optional second argument EXITING means ask about certain non-file buffers | 2395 Optional second argument EXITING means ask about certain non-file buffers |
2396 as well as about file buffers." | 2396 as well as about file buffers." |
2397 (interactive "P") | 2397 (interactive "P") |
2398 (save-excursion | 2398 (save-excursion |
2399 (save-window-excursion | 2399 ;; `delete-other-windows' can bomb during autoloads generation, so |
2400 ;; This can bomb during autoloads generation | 2400 ;; guard it well. |
2401 (when (and (not noninteractive) | 2401 (if (or noninteractive |
2402 (not (eq (selected-window) (minibuffer-window))) | 2402 (eq (selected-window) (minibuffer-window)) |
2403 save-some-buffers-query-display-buffer) | 2403 (not save-some-buffers-query-display-buffer)) |
2404 (delete-other-windows)) | 2404 ;; If playing with windows is unsafe or undesired, just do the |
2405 ;; XEmacs - do not use queried flag | 2405 ;; usual drill. |
2406 (let ((files-done | 2406 (save-some-buffers-1 arg exiting nil) |
2407 (map-y-or-n-p | 2407 ;; Else, protect the windows. |
2408 (function | 2408 (delete-other-windows) |
2409 (lambda (buffer) | 2409 (save-window-excursion |
2410 (and (buffer-modified-p buffer) | 2410 (save-some-buffers-1 arg exiting t)) |
2411 (not (buffer-base-buffer buffer)) | 2411 ;; Force redisplay. #### Perhaps this should be handled |
2412 ;; XEmacs addition: | 2412 ;; automatically by `save-window-excursion'. |
2413 (not (symbol-value-in-buffer 'save-buffers-skip buffer)) | 2413 (sit-for 1)))) |
2414 (or | 2414 |
2415 (buffer-file-name buffer) | 2415 ;; XEmacs - do not use queried flag |
2416 (and exiting | 2416 (defun save-some-buffers-1 (arg exiting switch-buffer) |
2417 (progn | 2417 (let ((files-done |
2418 (set-buffer buffer) | 2418 (map-y-or-n-p |
2419 (and buffer-offer-save (> (buffer-size) 0))))) | 2419 (lambda (buffer) |
2420 (if arg | 2420 (and (buffer-modified-p buffer) |
2421 t | 2421 (not (buffer-base-buffer buffer)) |
2422 (when save-some-buffers-query-display-buffer | 2422 ;; XEmacs addition: |
2423 (condition-case nil | 2423 (not (symbol-value-in-buffer 'save-buffers-skip buffer)) |
2424 (switch-to-buffer buffer t) | 2424 (or |
2425 (error nil))) | 2425 (buffer-file-name buffer) |
2426 (if (buffer-file-name buffer) | 2426 (and exiting |
2427 (format "Save file %s? " | 2427 (progn |
2428 (buffer-file-name buffer)) | 2428 (set-buffer buffer) |
2429 (format "Save buffer %s? " | 2429 (and buffer-offer-save (> (buffer-size) 0))))) |
2430 (buffer-name buffer))))))) | 2430 (if arg |
2431 (function | 2431 t |
2432 (lambda (buffer) | 2432 ;; #### We should provide a per-buffer means to |
2433 (set-buffer buffer) | 2433 ;; disable the switching. |
2434 (condition-case () | 2434 (when switch-buffer |
2435 (save-buffer) | 2435 ;; #### Consider using `display-buffer' here for 21.1! |
2436 (error nil)))) | 2436 ;(display-buffer buffer nil (selected-frame))) |
2437 (buffer-list) | 2437 (switch-to-buffer buffer t)) |
2438 '("buffer" "buffers" "save") | 2438 (if (buffer-file-name buffer) |
2439 ;;instead of this we just say "yes all", "no all", etc. | 2439 (format "Save file %s? " |
2440 ;;"save all the rest" | 2440 (buffer-file-name buffer)) |
2441 ;;"save only this buffer" "save no more buffers") | 2441 (format "Save buffer %s? " |
2442 ;; this is rather bogus. --ben | 2442 (buffer-name buffer)))))) |
2443 ;; (it makes the dialog box too big, and you get an error | 2443 (lambda (buffer) |
2444 ;; "wrong type argument: framep, nil" when you hit q after | 2444 (set-buffer buffer) |
2445 ;; choosing the option from the dialog box) | 2445 (condition-case () |
2446 | 2446 (save-buffer) |
2447 ;; We should fix the dialog box rather than disabling | 2447 (error nil))) |
2448 ;; this! --hniksic | 2448 (buffer-list) |
2449 (list (list ?\C-r (lambda (buf) | 2449 '("buffer" "buffers" "save") |
2450 ;; FSF has an EXIT-ACTION argument to | 2450 ;;instead of this we just say "yes all", "no all", etc. |
2451 ;; `view-buffer'. | 2451 ;;"save all the rest" |
2452 (view-buffer buf) | 2452 ;;"save only this buffer" "save no more buffers") |
2453 (setq view-exit-action | 2453 ;; this is rather bogus. --ben |
2454 (lambda (ignore) | 2454 ;; (it makes the dialog box too big, and you get an error |
2455 (exit-recursive-edit))) | 2455 ;; "wrong type argument: framep, nil" when you hit q after |
2456 (recursive-edit) | 2456 ;; choosing the option from the dialog box) |
2457 ;; Return nil to ask about BUF again. | 2457 |
2458 nil) | 2458 ;; We should fix the dialog box rather than disabling |
2459 "display the current buffer")))) | 2459 ;; this! --hniksic |
2460 (abbrevs-done | 2460 (list (list ?\C-r (lambda (buf) |
2461 (and save-abbrevs abbrevs-changed | 2461 ;; #### FSF has an EXIT-ACTION argument |
2462 (progn | 2462 ;; to `view-buffer'. |
2463 (if (or arg | 2463 (view-buffer buf) |
2464 (y-or-n-p (format "Save abbrevs in %s? " abbrev-file-name))) | 2464 (setq view-exit-action |
2465 (write-abbrev-file nil)) | 2465 (lambda (ignore) |
2466 ;; Don't keep bothering user if he says no. | 2466 (exit-recursive-edit))) |
2467 (setq abbrevs-changed nil) | 2467 (recursive-edit) |
2468 t)))) | 2468 ;; Return nil to ask about BUF again. |
2469 (or (> files-done 0) abbrevs-done | 2469 nil) |
2470 (display-message 'no-log "(No files need saving)")))))) | 2470 "display the current buffer")))) |
2471 (abbrevs-done | |
2472 (and save-abbrevs abbrevs-changed | |
2473 (progn | |
2474 (if (or arg | |
2475 (y-or-n-p (format "Save abbrevs in %s? " abbrev-file-name))) | |
2476 (write-abbrev-file nil)) | |
2477 ;; Don't keep bothering user if he says no. | |
2478 (setq abbrevs-changed nil) | |
2479 t)))) | |
2480 (or (> files-done 0) abbrevs-done | |
2481 (display-message 'no-log "(No files need saving)")))) | |
2471 | 2482 |
2472 | 2483 |
2473 (defun not-modified (&optional arg) | 2484 (defun not-modified (&optional arg) |
2474 "Mark current buffer as unmodified, not needing to be saved. | 2485 "Mark current buffer as unmodified, not needing to be saved. |
2475 With prefix arg, mark buffer as modified, so \\[save-buffer] will save. | 2486 With prefix arg, mark buffer as modified, so \\[save-buffer] will save. |