comparison lisp/files.el @ 5398:499f25507242

(save-some-buffers): Fix previous change.
author Richard M. Stallman <rms@gnu.org>
date Sat, 01 Jan 1994 06:21:59 +0000
parents 09148c696fa2
children 691f7961e32c
comparison
equal deleted inserted replaced
5397:1209d8bbffd3 5398:499f25507242
1525 Optional argument (the prefix) non-nil means save all with no questions. 1525 Optional argument (the prefix) non-nil means save all with no questions.
1526 Optional second argument EXITING means ask about certain non-file buffers 1526 Optional second argument EXITING means ask about certain non-file buffers
1527 as well as about file buffers." 1527 as well as about file buffers."
1528 (interactive "P") 1528 (interactive "P")
1529 (save-window-excursion 1529 (save-window-excursion
1530 (or (not (zerop (map-y-or-n-p 1530 (let ((files-done
1531 (function 1531 (map-y-or-n-p
1532 (lambda (buffer) 1532 (function
1533 (and (buffer-modified-p buffer) 1533 (lambda (buffer)
1534 (or 1534 (and (buffer-modified-p buffer)
1535 (buffer-file-name buffer) 1535 (or
1536 (and exiting 1536 (buffer-file-name buffer)
1537 (progn 1537 (and exiting
1538 (set-buffer buffer) 1538 (progn
1539 (and buffer-offer-save (> (buffer-size) 0))))) 1539 (set-buffer buffer)
1540 (if arg 1540 (and buffer-offer-save (> (buffer-size) 0)))))
1541 t 1541 (if arg
1542 (if (buffer-file-name buffer) 1542 t
1543 (format "Save file %s? " 1543 (if (buffer-file-name buffer)
1544 (buffer-file-name buffer)) 1544 (format "Save file %s? "
1545 (format "Save buffer %s? " 1545 (buffer-file-name buffer))
1546 (buffer-name buffer))))))) 1546 (format "Save buffer %s? "
1547 (function 1547 (buffer-name buffer)))))))
1548 (lambda (buffer) 1548 (function
1549 (set-buffer buffer) 1549 (lambda (buffer)
1550 (save-buffer))) 1550 (set-buffer buffer)
1551 (buffer-list) 1551 (save-buffer)))
1552 '("buffer" "buffers" "save") 1552 (buffer-list)
1553 (list (list ?\C-r (lambda (buf) 1553 '("buffer" "buffers" "save")
1554 (view-buffer buf) 1554 (list (list ?\C-r (lambda (buf)
1555 (setq view-exit-action 1555 (view-buffer buf)
1556 '(lambda (ignore) 1556 (setq view-exit-action
1557 (exit-recursive-edit))) 1557 '(lambda (ignore)
1558 (recursive-edit) 1558 (exit-recursive-edit)))
1559 ;; Return nil to ask about BUF again. 1559 (recursive-edit)
1560 nil) 1560 ;; Return nil to ask about BUF again.
1561 "display the current buffer")) 1561 nil)
1562 ))) 1562 "display the current buffer"))))
1563 (and save-abbrevs abbrevs-changed 1563 (abbrevs-done
1564 (progn 1564 (and save-abbrevs abbrevs-changed
1565 (if (or arg 1565 (progn
1566 (y-or-n-p (format "Save abbrevs in %s? " abbrev-file-name))) 1566 (if (or arg
1567 (write-abbrev-file nil)) 1567 (y-or-n-p (format "Save abbrevs in %s? " abbrev-file-name)))
1568 ;; Don't keep bothering user if he says no. 1568 (write-abbrev-file nil))
1569 (setq abbrevs-changed nil) 1569 ;; Don't keep bothering user if he says no.
1570 t)) 1570 (setq abbrevs-changed nil)
1571 (message "(No files need saving)")))) 1571 t))))
1572 (or (> files-done 0) abbrevs-done
1573 (message "(No files need saving)")))))
1572 1574
1573 (defun not-modified (&optional arg) 1575 (defun not-modified (&optional arg)
1574 "Mark current buffer as unmodified, not needing to be saved. 1576 "Mark current buffer as unmodified, not needing to be saved.
1575 With prefix arg, mark buffer as modified, so \\[save-buffer] will save." 1577 With prefix arg, mark buffer as modified, so \\[save-buffer] will save."
1576 (interactive "P") 1578 (interactive "P")