Commit 2de386ca authored by Michael Kifer's avatar Michael Kifer
Browse files

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.
parent dab816a9
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.
2009-12-07 Michael Albinus <michael.albinus@gmx.de>
Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphaël
......
......@@ -1548,7 +1548,8 @@ This default should work without changes."
(defun ediff-event-key (event-or-key)
(if (featurep 'xemacs)
(if (eventp event-or-key) (event-key event-or-key) event-or-key)
;;(if (eventp event-or-key) (event-key event-or-key) event-or-key)
(if (eventp event-or-key) (event-to-character event-or-key t t) event-or-key)
event-or-key))
(defun ediff-last-command-char ()
......
......@@ -392,12 +392,40 @@ Toggled by ediff-toggle-verbose-help-meta-buffer" )
(define-key ediff-meta-buffer-map "p" 'ediff-previous-meta-item)
(define-key ediff-meta-buffer-map [delete] 'ediff-previous-meta-item)
(define-key ediff-meta-buffer-map [backspace] 'ediff-previous-meta-item)
(or (ediff-one-filegroup-metajob)
(progn
(define-key ediff-meta-buffer-map "=" nil)
(define-key ediff-meta-buffer-map "==" 'ediff-meta-mark-equal-files)
(define-key ediff-meta-buffer-map "=m" 'ediff-meta-mark-equal-files)
(define-key ediff-meta-buffer-map "=h" 'ediff-meta-mark-equal-files)))
(let ((menu-map (make-sparse-keymap "Ediff-Meta")))
(define-key ediff-meta-buffer-map [menu-bar ediff-meta-mode]
(cons "Ediff-Meta" menu-map))
(define-key menu-map [ediff-quit-meta-buffer]
'(menu-item "Quit" ediff-quit-meta-buffer
:help "Quit the meta buffer"))
(define-key menu-map [ediff-toggle-filename-truncation]
'(menu-item "Truncate filenames" ediff-toggle-filename-truncation
:help "Toggle truncation of long file names in session group buffers"
:button (:toggle . ediff-meta-truncate-filenames)))
(define-key menu-map [ediff-show-registry]
'(menu-item "Display Ediff Registry" ediff-show-registry
:help "Display Ediff's registry"))
(define-key menu-map [ediff-documentation]
'(menu-item "Show Manual" ediff-documentation
:help "Display Ediff's manual"))
(or (ediff-one-filegroup-metajob)
(progn
(define-key ediff-meta-buffer-map "=" nil)
(define-key ediff-meta-buffer-map "==" 'ediff-meta-mark-equal-files)
(define-key ediff-meta-buffer-map "=m" 'ediff-meta-mark-equal-files)
(define-key ediff-meta-buffer-map "=h" 'ediff-meta-mark-equal-files)))
(define-key menu-map [ediff-next-meta-item]
'(menu-item "Next" ediff-next-meta-item
:help "Move to the next item in Ediff registry or session group buffer"))
(define-key menu-map [ediff-previous-meta-item]
'(menu-item "Previous" ediff-previous-meta-item
:help "Move to the previous item in Ediff registry or session group buffer")))
(if ediff-no-emacs-help-in-control-buffer
(define-key ediff-meta-buffer-map "\C-h" 'ediff-previous-meta-item))
(if (featurep 'emacs)
......@@ -837,14 +865,58 @@ behavior."
ediff-meta-buffer-map "um" 'ediff-unmark-all-for-operation)
(define-key
ediff-meta-buffer-map "uh" 'ediff-unmark-all-for-hiding)
(define-key ediff-meta-buffer-map
[menu-bar ediff-meta-mode ediff-hide-marked-sessions]
'(menu-item "Hide marked" ediff-hide-marked-sessions
:help "Hide marked sessions. With prefix arg, unhide"))
(define-key ediff-meta-buffer-map
[menu-bar ediff-meta-mode ediff-mark-for-hiding-at-pos]
'(menu-item "Mark for hiding" ediff-mark-for-hiding-at-pos
:help "Mark session for hiding. With prefix arg, unmark"))
(define-key ediff-meta-buffer-map
[menu-bar ediff-meta-mode ediff-mark-for-operation-at-pos]
'(menu-item "Mark for group operation" ediff-mark-for-operation-at-pos
:help "Mark session for a group operation. With prefix arg, unmark."))
(define-key ediff-meta-buffer-map
[menu-bar ediff-meta-mode ediff-unmark-all-for-hiding]
'(menu-item "Unmark all for hiding" ediff-unmark-all-for-hiding
:help "Unmark all sessions marked for hiding"))
(define-key ediff-meta-buffer-map
[menu-bar ediff-meta-mode ediff-unmark-all-for-operation]
'(menu-item "Unmark all for group operation" ediff-unmark-all-for-operation
:help "Unmark all sessions marked for operation"))
(cond ((ediff-collect-diffs-metajob jobname)
(define-key ediff-meta-buffer-map
[menu-bar ediff-meta-mode ediff-collect-custom-diffs]
'(menu-item "Collect diffs" ediff-collect-custom-diffs
:help "Collect custom diffs of marked sessions in buffer `*Ediff Multifile Diffs*'"))
(define-key
ediff-meta-buffer-map "P" 'ediff-collect-custom-diffs))
((ediff-patch-metajob jobname)
(define-key ediff-meta-buffer-map
[menu-bar ediff-meta-mode ediff-meta-show-patch]
'(menu-item "Show multi-file patch" ediff-meta-show-patch
:help "Show the multi-file patch associated with this group session"))
(define-key
ediff-meta-buffer-map "P" 'ediff-meta-show-patch)))
(define-key ediff-meta-buffer-map "^" 'ediff-up-meta-hierarchy)
(define-key ediff-meta-buffer-map "D" 'ediff-show-dir-diffs)))
(define-key ediff-meta-buffer-map "D" 'ediff-show-dir-diffs)
(define-key ediff-meta-buffer-map
[menu-bar ediff-meta-mode ediff-up-meta-hierarchy]
'(menu-item "Go to parent session" ediff-up-meta-hierarchy
:help "Go to the parent session group buffer"))
(define-key ediff-meta-buffer-map
[menu-bar ediff-meta-mode ediff-show-dir-diffs]
'(menu-item "Diff directories" ediff-show-dir-diffs
:help "Display differences among the directories involved in session group"))))
(if (eq ediff-metajob-name 'ediff-registry)
(run-hooks 'ediff-registry-setup-hook)
......
......@@ -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)))
))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment