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)))
(config (current-window-configuration)))
(if (= (length args) 2)
(setq args nil)
(setcdr (last args 3) nil))
(with-current-buffer
(condition-case nil
(diff-no-select
old new
(nil-blank-string (eshell-flatten-and-stringify args)))
(error
(throw 'eshell-replace-command
(eshell-parse-command "*diff" orig-args))))
(when (fboundp 'diff-mode)
(add-hook
'compilation-finish-functions
(lambda (buff _msg)
(with-current-buffer buff
(diff-mode)
(setq-local eshell-diff-window-config config)
(local-set-key [?q] #'eshell-diff-quit)
(if (fboundp 'turn-on-font-lock-if-enabled)
(turn-on-font-lock-if-enabled))
(goto-char (point-min))))
nil t))
(pop-to-buffer (current-buffer))))))
nil)