diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-06-11 01:47:48 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-06-11 01:47:48 +0000 |
commit | 89800cf05f9c3417b3f8bf544f7ffd8ad977e26c (patch) | |
tree | 1b8cf810b81a1a465e095f6a61bcab24868328c7 /lisp/files.el | |
parent | 40b9031629a790b8acafa35680ebbee1740b026e (diff) | |
download | emacs-89800cf05f9c3417b3f8bf544f7ffd8ad977e26c.tar.gz |
* emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
* files.el (save-some-buffers-action-alist): Only use recursive-edit
if the user enabled recursive-minibuffers.
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 84 |
1 files changed, 44 insertions, 40 deletions
diff --git a/lisp/files.el b/lisp/files.el index 0dc8ba20b2d..b38871096cc 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4163,22 +4163,28 @@ This requires the external program `diff' to be in your `exec-path'." nil) (defvar save-some-buffers-action-alist - '((?\C-r - (lambda (buf) - (view-buffer buf - (lambda (ignore) - (exit-recursive-edit))) - (recursive-edit) - ;; Return nil to ask about BUF again. - nil) + `((?\C-r + ,(lambda (buf) + (if (not enable-recursive-minibuffers) + (progn (display-buffer buf) + (setq other-window-scroll-buffer buf)) + (view-buffer buf (lambda (_) (exit-recursive-edit))) + (recursive-edit)) + ;; Return nil to ask about BUF again. + nil) "view this buffer") - (?d (lambda (buf) - (save-window-excursion - (diff-buffer-with-file buf)) - (view-buffer (get-buffer-create "*Diff*") - (lambda (ignore) (exit-recursive-edit))) - (recursive-edit) - nil) + (?d ,(lambda (buf) + (if (null buffer-file-name) + (message "Not applicable: no file") + (save-window-excursion (diff-buffer-with-file buf)) + (if (not enable-recursive-minibuffers) + (progn (display-buffer (get-buffer-create "*Diff*")) + (setq other-window-scroll-buffer "*Diff*")) + (view-buffer (get-buffer-create "*Diff*") + (lambda (_) (exit-recursive-edit))) + (recursive-edit))) + ;; Return nil to ask about BUF again. + nil) "view changes in this buffer")) "ACTION-ALIST argument used in call to `map-y-or-n-p'.") @@ -4216,31 +4222,29 @@ change the additional actions you can take on files." ;; and record the number thus saved. (setq files-done (map-y-or-n-p - (function - (lambda (buffer) - (and (buffer-modified-p buffer) - (not (buffer-base-buffer buffer)) - (or - (buffer-file-name buffer) - (and pred - (progn - (set-buffer buffer) - (and buffer-offer-save (> (buffer-size) 0))))) - (or (not (functionp pred)) - (with-current-buffer buffer (funcall pred))) - (if arg - t - (setq queried t) - (if (buffer-file-name buffer) - (format "Save file %s? " - (buffer-file-name buffer)) - (format "Save buffer %s? " - (buffer-name buffer))))))) - (function - (lambda (buffer) - (set-buffer buffer) - (save-buffer))) - (buffer-list) + (lambda (buffer) + (and (buffer-modified-p buffer) + (not (buffer-base-buffer buffer)) + (or + (buffer-file-name buffer) + (and pred + (progn + (set-buffer buffer) + (and buffer-offer-save (> (buffer-size) 0))))) + (or (not (functionp pred)) + (with-current-buffer buffer (funcall pred))) + (if arg + t + (setq queried t) + (if (buffer-file-name buffer) + (format "Save file %s? " + (buffer-file-name buffer)) + (format "Save buffer %s? " + (buffer-name buffer)))))) + (lambda (buffer) + (with-current-buffer buffer + (save-buffer))) + (buffer-list) '("buffer" "buffers" "save") save-some-buffers-action-alist)) ;; Maybe to save abbrevs, and record whether |