Function: eshell/diff

eshell/diff is a byte-compiled function defined in em-unix.el.gz.

Signature

(eshell/diff &rest ARGS)

Documentation

Alias "diff" to call Emacs diff function.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/em-unix.el.gz
(defun eshell/diff (&rest args)
  "Alias \"diff\" to call Emacs `diff' function."
  (let ((orig-args (eshell-stringify-list (flatten-tree args))))
    (if (or eshell-plain-diff-behavior
	    (not (and (eshell-interactive-output-p)
		      (not eshell-in-pipeline-p)
		      (not eshell-in-subcommand-p))))
	(throw 'eshell-replace-command
	       (eshell-parse-command "*diff" orig-args))
      (setq args (copy-sequence orig-args))
      (if (< (length args) 2)
	  (throw 'eshell-replace-command
		 (eshell-parse-command "*diff" orig-args)))
      (let ((old (car (last args 2)))
            (new (car (last args))))
	(if (= (length args) 2)
	    (setq args nil)
	  (setcdr (last args 3) nil))
	(with-current-buffer
	    (condition-case nil
		(diff-no-select
		 old new
                 (eshell-nil-blank-string (eshell-flatten-and-stringify args)))
	      (error
	       (throw 'eshell-replace-command
		      (eshell-parse-command "*diff" orig-args))))
	  (pop-to-buffer (current-buffer))))))
  nil)