diff options
author | Michael Kifer <kifer@cs.stonybrook.edu> | 2009-12-07 06:56:40 +0000 |
---|---|---|
committer | Michael Kifer <kifer@cs.stonybrook.edu> | 2009-12-07 06:56:40 +0000 |
commit | 2de386ca1d481a544e6fed79baaa19adcc80161d (patch) | |
tree | 4037b6959bfce053dec319fdb1336ba1e22a385a /lisp/ediff.el | |
parent | dab816a917fffcd49a26b422a7b5d435bc3e8b78 (diff) | |
download | emacs-2de386ca1d481a544e6fed79baaa19adcc80161d.tar.gz |
2009-12-07 Michael Kifer <kifer@cs.stonybrook.edu>
* ediff-init.el (ediff-event-key): use event-to-character instead of
event-key.
* ediff-mult.el (ediff-setup-meta-map, ediff-prepare-meta-buffer): add
menus to the meta mode. (Dan Nicolaescu's <dann@ics.uci.edu> patch.)
* ediff.el (ediff-buffers-internal): add unwind-protect.
Diffstat (limited to 'lisp/ediff.el')
-rw-r--r-- | lisp/ediff.el | 149 |
1 files changed, 81 insertions, 68 deletions
diff --git a/lisp/ediff.el b/lisp/ediff.el index ad2f3c0de2e..f2bf51d3994 100644 --- a/lisp/ediff.el +++ b/lisp/ediff.el @@ -12,8 +12,8 @@ ;; filed in the Emacs bug reporting system against this file, a copy ;; of the bug report be sent to the maintainer's email address. -(defconst ediff-version "2.81.3" "The current version of Ediff") -(defconst ediff-date "August 15, 2009" "Date of last update") +(defconst ediff-version "2.81.4" "The current version of Ediff") +(defconst ediff-date "December 7, 2009" "Date of last update") ;; This file is part of GNU Emacs. @@ -475,37 +475,45 @@ If this file is a backup, `ediff' it with its original." (buf-C-file-name (if buf-C-is-alive (buffer-file-name (get-buffer buf-B)))) file-A file-B file-C) - (if (not (ediff-buffer-live-p buf-A)) - (error "Buffer %S doesn't exist" buf-A)) - (if (not (ediff-buffer-live-p buf-B)) - (error "Buffer %S doesn't exist" buf-B)) - (let ((ediff-job-name job-name)) - (if (and ediff-3way-comparison-job - (not buf-C-is-alive)) - (error "Buffer %S doesn't exist" buf-C))) - (if (stringp buf-A-file-name) - (setq buf-A-file-name (file-name-nondirectory buf-A-file-name))) - (if (stringp buf-B-file-name) - (setq buf-B-file-name (file-name-nondirectory buf-B-file-name))) - (if (stringp buf-C-file-name) - (setq buf-C-file-name (file-name-nondirectory buf-C-file-name))) - - (setq file-A (ediff-make-temp-file buf-A buf-A-file-name) - file-B (ediff-make-temp-file buf-B buf-B-file-name)) - (if buf-C-is-alive - (setq file-C (ediff-make-temp-file buf-C buf-C-file-name))) - - (ediff-setup (get-buffer buf-A) file-A - (get-buffer buf-B) file-B - (if buf-C-is-alive (get-buffer buf-C)) - file-C - (cons `(lambda () - (delete-file ,file-A) - (delete-file ,file-B) - (if (stringp ,file-C) (delete-file ,file-C))) - startup-hooks) - (list (cons 'ediff-job-name job-name)) - merge-buffer-file))) + (unwind-protect + (progn + (if (not (ediff-buffer-live-p buf-A)) + (error "Buffer %S doesn't exist" buf-A)) + (if (not (ediff-buffer-live-p buf-B)) + (error "Buffer %S doesn't exist" buf-B)) + (let ((ediff-job-name job-name)) + (if (and ediff-3way-comparison-job + (not buf-C-is-alive)) + (error "Buffer %S doesn't exist" buf-C))) + (if (stringp buf-A-file-name) + (setq buf-A-file-name (file-name-nondirectory buf-A-file-name))) + (if (stringp buf-B-file-name) + (setq buf-B-file-name (file-name-nondirectory buf-B-file-name))) + (if (stringp buf-C-file-name) + (setq buf-C-file-name (file-name-nondirectory buf-C-file-name))) + + (setq file-A (ediff-make-temp-file buf-A buf-A-file-name) + file-B (ediff-make-temp-file buf-B buf-B-file-name)) + (if buf-C-is-alive + (setq file-C (ediff-make-temp-file buf-C buf-C-file-name))) + + (ediff-setup (get-buffer buf-A) file-A + (get-buffer buf-B) file-B + (if buf-C-is-alive (get-buffer buf-C)) + file-C + (cons `(lambda () + (delete-file ,file-A) + (delete-file ,file-B) + (if (stringp ,file-C) (delete-file ,file-C))) + startup-hooks) + (list (cons 'ediff-job-name job-name)) + merge-buffer-file)) + (if (and (stringp file-A) (file-exists-p file-A)) + (delete-file file-A)) + (if (and (stringp file-B) (file-exists-p file-B)) + (delete-file file-B)) + (if (and (stringp file-C) (file-exists-p file-C)) + (delete-file file-C))))) ;;; Directory and file group operations @@ -1055,41 +1063,46 @@ lines. For small regions, use `ediff-regions-wordwise'." (let ((tmp-buffer (get-buffer-create ediff-tmp-buffer)) overl-A overl-B file-A file-B) - - ;; in case beg/end-A/B aren't markers--make them into markers - (ediff-with-current-buffer buffer-A - (setq beg-A (move-marker (make-marker) beg-A) - end-A (move-marker (make-marker) end-A))) - (ediff-with-current-buffer buffer-B - (setq beg-B (move-marker (make-marker) beg-B) - end-B (move-marker (make-marker) end-B))) - - ;; make file-A - (if word-mode - (ediff-wordify beg-A end-A buffer-A tmp-buffer) - (ediff-copy-to-buffer beg-A end-A buffer-A tmp-buffer)) - (setq file-A (ediff-make-temp-file tmp-buffer "regA")) - - ;; make file-B - (if word-mode - (ediff-wordify beg-B end-B buffer-B tmp-buffer) - (ediff-copy-to-buffer beg-B end-B buffer-B tmp-buffer)) - (setq file-B (ediff-make-temp-file tmp-buffer "regB")) - - (setq overl-A (ediff-make-bullet-proof-overlay beg-A end-A buffer-A)) - (setq overl-B (ediff-make-bullet-proof-overlay beg-B end-B buffer-B)) - (ediff-setup buffer-A file-A - buffer-B file-B - nil nil ; buffer & file C - (cons `(lambda () - (delete-file ,file-A) - (delete-file ,file-B)) - startup-hooks) - (append - (list (cons 'ediff-word-mode word-mode) - (cons 'ediff-narrow-bounds (list overl-A overl-B)) - (cons 'ediff-job-name job-name)) - setup-parameters)) + (unwind-protect + (progn + ;; in case beg/end-A/B aren't markers--make them into markers + (ediff-with-current-buffer buffer-A + (setq beg-A (move-marker (make-marker) beg-A) + end-A (move-marker (make-marker) end-A))) + (ediff-with-current-buffer buffer-B + (setq beg-B (move-marker (make-marker) beg-B) + end-B (move-marker (make-marker) end-B))) + + ;; make file-A + (if word-mode + (ediff-wordify beg-A end-A buffer-A tmp-buffer) + (ediff-copy-to-buffer beg-A end-A buffer-A tmp-buffer)) + (setq file-A (ediff-make-temp-file tmp-buffer "regA")) + + ;; make file-B + (if word-mode + (ediff-wordify beg-B end-B buffer-B tmp-buffer) + (ediff-copy-to-buffer beg-B end-B buffer-B tmp-buffer)) + (setq file-B (ediff-make-temp-file tmp-buffer "regB")) + + (setq overl-A (ediff-make-bullet-proof-overlay beg-A end-A buffer-A)) + (setq overl-B (ediff-make-bullet-proof-overlay beg-B end-B buffer-B)) + (ediff-setup buffer-A file-A + buffer-B file-B + nil nil ; buffer & file C + (cons `(lambda () + (delete-file ,file-A) + (delete-file ,file-B)) + startup-hooks) + (append + (list (cons 'ediff-word-mode word-mode) + (cons 'ediff-narrow-bounds (list overl-A overl-B)) + (cons 'ediff-job-name job-name)) + setup-parameters))) + (if (and (stringp file-A) (file-exists-p file-A)) + (delete-file file-A)) + (if (and (stringp file-B) (file-exists-p file-B)) + (delete-file file-B))) )) |