X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/db0406bb64f7e5dceeb257c7e350f1e80ed9c1c1..0877d0dc24ee792b9b14592869ea1aa0934aee58:/lisp/vc/ediff-util.el diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 40ffea624f..2456d6ede4 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -1,6 +1,6 @@ ;;; ediff-util.el --- the core commands and utilities of ediff -;; Copyright (C) 1994-2011 Free Software Foundation, Inc. +;; Copyright (C) 1994-2013 Free Software Foundation, Inc. ;; Author: Michael Kifer ;; Package: ediff @@ -452,7 +452,7 @@ to invocation.") (if ediff-3way-job (ediff-with-current-buffer ediff-buffer-C (ediff-nuke-selective-display) - ;; the merge bufer should never be narrowed + ;; the merge buffer should never be narrowed ;; (it can happen if it is on rmail-mode or similar) (if (ediff-with-current-buffer control-buffer ediff-merge-job) (widen)) @@ -1907,8 +1907,8 @@ in the specified buffer." (cond ((eq which-diff 'after) (1+ diff-no)) ((eq which-diff 'before) diff-no) - ((< (abs (count-lines pos (max 1 prev-end))) - (abs (count-lines pos (max 1 beg)))) + ((< (abs (count-lines pos (max (point-min) prev-end))) + (abs (count-lines pos (max (point-min) beg)))) diff-no) ; choose prev difference (t (1+ diff-no))) ; choose next difference @@ -2635,7 +2635,7 @@ delete this buffer in another session as well." )) ;; Kill the variant buffer, according to user directives (ask, kill -;; unconditionaly, keep) +;; unconditionally, keep) ;; BUFF is the buffer, BUFF-TYPE is either 'A, or 'B, 'C, 'Ancestor (defun ediff-dispose-of-variant-according-to-user (buff bufftype ask keep-variants) ;; if this is indirect buffer, kill it and substitute with direct buf @@ -3103,7 +3103,7 @@ Hit \\[ediff-recenter] to reset the windows afterward." ;; according to context. ;; If DEFAULT-FILE is set, it should be used as the default value. ;; If DEFAULT-DIR is non-nil, use it as the default directory. -;; Otherwise, use the value of Emacs' variable `default-directory.' +;; Otherwise, use the value of `default-directory.' (defun ediff-read-file-name (prompt default-dir default-file &optional no-dirs) ;; hack default-dir if it is not set (setq default-dir @@ -3378,10 +3378,18 @@ Without an argument, it saves customized diff argument, if available (set-window-buffer wind cloned-buff) cloned-buff)) -(defun ediff-clone-buffer-for-current-diff-comparison (buff buf-type reg-name) - (let ((cloned-buff (ediff-make-cloned-buffer buff reg-name)) - (reg-start (ediff-get-diff-posn buf-type 'beg)) - (reg-end (ediff-get-diff-posn buf-type 'end))) +(defun ediff-buffer-type (buffer) + (cond ((eq buffer ediff-buffer-A) 'A) + ((eq buffer ediff-buffer-B) 'B) + ((eq buffer ediff-buffer-C) 'C) + ((eq buffer ediff-ancestor-buffer) 'Ancestor) + (t nil))) + +(defun ediff-clone-buffer-for-current-diff-comparison (buff reg-name) + (let* ((cloned-buff (ediff-make-cloned-buffer buff reg-name)) + (buf-type (ediff-buffer-type buff)) + (reg-start (ediff-get-diff-posn buf-type 'beg)) + (reg-end (ediff-get-diff-posn buf-type 'end))) (ediff-with-current-buffer cloned-buff ;; set region to be the current diff region (goto-char reg-start) @@ -3466,7 +3474,7 @@ Without an argument, it saves customized diff argument, if available (defun ediff-inferior-compare-regions () "Compare regions in an active Ediff session. -Like ediff-regions-linewise but is called from under an active Ediff session on +Like `ediff-regions-linewise' but is called from under an active Ediff session on the files that belong to that session. After quitting the session invoked via this function, type C-l to the parent @@ -3555,7 +3563,7 @@ Ediff Control Panel to restore highlighting." (setq bufA (if use-current-diff-p (ediff-clone-buffer-for-current-diff-comparison - bufA 'A "-Region.A-") + bufA "-Region.A-") (ediff-clone-buffer-for-region-comparison bufA "-Region.A-"))) (ediff-with-current-buffer bufA (setq begA (region-beginning) @@ -3570,7 +3578,7 @@ Ediff Control Panel to restore highlighting." (setq bufB (if use-current-diff-p (ediff-clone-buffer-for-current-diff-comparison - bufB 'B "-Region.B-") + bufB "-Region.B-") (ediff-clone-buffer-for-region-comparison bufB "-Region.B-"))) (ediff-with-current-buffer bufB (setq begB (region-beginning) @@ -3811,7 +3819,7 @@ Ediff Control Panel to restore highlighting." ;; later, and nconc above will break it. Either this or use slow ;; append instead of nconc (selected-buffers (ediff-get-selected-buffers)) - (prefered-buffer (car all-buffers)) + (preferred-buffer (car all-buffers)) visible-dired-buffers (excl-buff-name-list (mapcar @@ -3841,7 +3849,7 @@ Ediff Control Panel to restore highlighting." (cond ((member (buffer-name x) excl-buff-name-list) nil) ((memq x selected-buffers) x) ((not (ediff-get-visible-buffer-window x)) nil) - ((eq x prefered-buffer) x) + ((eq x preferred-buffer) x) ;; if prev selected buffer is dired, look only at ;; dired. ((eq use-dired-major-mode 'yes) @@ -4144,15 +4152,9 @@ Mail anyway? (y or n) ") ;; calculate time used by command (defun ediff-calc-command-time () - (let ((end (current-time)) - micro sec) - (setq micro - (if (>= (nth 2 end) (nth 2 ediff-command-begin-time)) - (- (nth 2 end) (nth 2 ediff-command-begin-time)) - (+ (nth 2 end) (- 1000000 (nth 2 ediff-command-begin-time))))) - (setq sec (- (nth 1 end) (nth 1 ediff-command-begin-time))) - (or (equal ediff-command-begin-time '(0 0 0)) - (message "Elapsed time: %d second(s) + %d microsecond(s)" sec micro)))) + (or (equal ediff-command-begin-time '(0 0 0)) + (message "Elapsed time: %g second(s)" + (float-time (time-since ediff-command-begin-time))))) (defsubst ediff-save-time () (setq ediff-command-begin-time (current-time)))