codeasone
codeasone

Reputation: 1983

Getting vc-diff to use ediff in Emacs 23.2

Had this working well in Emacs 23.1.x but it appears to have broke in the move to Emacs 23.2

I want to use ediff when comparing working copy of a file with SVN HEAD.

Normally I press C-x v = and ediff runs because of the following configuration in my .emacs

;; Use ediff and not diff 
(setq diff-command "ediff")

But, alas I still get the normal vc-diff buffer appearing and no ediff session...

Has anyone else encountered this and know what might be the problem?

Upvotes: 5

Views: 6096

Answers (3)

Feiming Chen
Feiming Chen

Reputation: 119

I use the command vc-ediff to skip entering the file names: just compare the current modified copy with the base version (HEAD).

(eval-after-load "vc-hooks"
         '(define-key vc-prefix-map "=" 'vc-ediff))

Then C-x v = will bring up the Ediff session.

Upvotes: 5

codeasone
codeasone

Reputation: 1983

Found out I could just rebind C-x v = to the following:

(defun ediff-current-buffer-revision () 
  "Run Ediff to diff current buffer's file against VC depot. 
Uses `vc.el' or `rcs.el' depending on `ediff-version-control-package'." 
  (interactive) 
  (let ((file (or (buffer-file-name) 
          (error "Current buffer is not visiting a file")))) 
(if (and (buffer-modified-p) 
     (y-or-n-p (message "Buffer %s is modified. Save buffer? " 
                (buffer-name)))) 
    (save-buffer (current-buffer))) 
(ediff-load-version-control) 
(funcall 
 (intern (format "ediff-%S-internal" ediff-version-control-package)) 
 "" "" nil))) 

This approach means you avoid having to specify the versions to compare as it defaults to comparing HEAD and the current file state.

Source: http://www.groupsrv.com/computers/about152826.html

Upvotes: 4

Trey Jackson
Trey Jackson

Reputation: 74430

Am a bit skeptical that the above setting did what you say it did.

That said, this will bind '=' to use 'ediff-revision:

(eval-after-load "vc-hooks"
         '(define-key vc-prefix-map "=" 'ediff-revision))

Upvotes: 8

Related Questions