Function: ediff-diff-to-diff

ediff-diff-to-diff is an interactive and byte-compiled function defined in ediff-util.el.gz.

Signature

(ediff-diff-to-diff ARG &optional KEYS)

Documentation

Copy buffer-X'th difference region to buffer Y (X,Y are A, B, or C).

With numerical prefix argument ARG, copy the difference specified in the arg. With prefix C-u (universal-argument), copy all differences. Otherwise, copy the difference given by ediff-current-difference. This command assumes it is bound to a 2-character key sequence, ab, ba, ac, etc., which is used to determine the types of buffers to be used for copying difference regions. The first character in the sequence specifies the source buffer and the second specifies the target.

If optional argument KEYS, a 2-character string, is given, use it to determine the source and the target buffers instead of the command keys.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/ediff-util.el.gz
;;; Copying diffs.

(defun ediff-diff-to-diff (arg &optional keys)
  "Copy buffer-X'th difference region to buffer Y (X,Y are A, B, or C).
With numerical prefix argument ARG, copy the difference specified in the
arg.  With prefix `\\[universal-argument]', copy all differences.
Otherwise, copy the difference given by `ediff-current-difference'.
This command assumes it is bound to a 2-character key sequence, `ab', `ba',
`ac', etc., which is used to determine the types of buffers to be used for
copying difference regions.  The first character in the sequence specifies
the source buffer and the second specifies the target.

If optional argument KEYS, a 2-character string, is given, use it
to determine the source and the target buffers instead of the
command keys."
  (interactive "P")
  (ediff-barf-if-not-control-buffer)
  (or keys (setq keys (this-command-keys)))
  (if (equal arg '(4))
      ;; copy all differences with `C-u' prefix
      (let ((n 0))
        (while (ediff-valid-difference-p n)
          (ediff-diff-to-diff (1+ n) keys)
          (setq n (1+ n))))
    (if (eq arg '-) (setq arg -1))      ; translate neg arg to -1
    (if (numberp arg) (ediff-jump-to-difference arg))

    (let* ((char1 (aref keys 0))
	   (char2 (aref keys 1))
	   ediff-verbose-p)
      (ediff-copy-diff ediff-current-difference
		       (ediff-char-to-buftype char1)
		       (ediff-char-to-buftype char2))
      ;; recenter with rehighlighting, but no messages
      (ediff-recenter))))