aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/vc/diff.el
diff options
context:
space:
mode:
authorJoakim Verona2013-02-12 00:04:05 +0100
committerJoakim Verona2013-02-12 00:04:05 +0100
commite0444a0966fa001953bb97cfb60451c42220be8e (patch)
treed5d10a2f99fa0c7b24eee310069e2677409e6802 /lisp/vc/diff.el
parent77f4834db1299b571b1fb3dfb120e5e50eec7cb1 (diff)
parent6659b59ccb7909a07f71a0143fd9d85e60b8e414 (diff)
downloademacs-e0444a0966fa001953bb97cfb60451c42220be8e.tar.gz
emacs-e0444a0966fa001953bb97cfb60451c42220be8e.zip
auto upstream
Diffstat (limited to 'lisp/vc/diff.el')
-rw-r--r--lisp/vc/diff.el25
1 files changed, 20 insertions, 5 deletions
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index 8b4ff792969..0fc0d2e3f73 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -114,6 +114,13 @@ specified in the variable `diff-switches' are passed to the diff command."
114 tempfile)) 114 tempfile))
115 (file-local-copy file-or-buf))) 115 (file-local-copy file-or-buf)))
116 116
117(defvar diff-use-labels 'check
118 "Whether `diff-command' understands the \"--label\" option.
119Possible values are:
120 t -- yes, it does
121 nil -- no, it does not
122 check -- try to probe whether it does")
123
117(defun diff-no-select (old new &optional switches no-async buf) 124(defun diff-no-select (old new &optional switches no-async buf)
118 ;; Noninteractive helper for creating and reverting diff buffers 125 ;; Noninteractive helper for creating and reverting diff buffers
119 (unless (bufferp new) (setq new (expand-file-name new))) 126 (unless (bufferp new) (setq new (expand-file-name new)))
@@ -121,6 +128,11 @@ specified in the variable `diff-switches' are passed to the diff command."
121 (or switches (setq switches diff-switches)) ; If not specified, use default. 128 (or switches (setq switches diff-switches)) ; If not specified, use default.
122 (unless (listp switches) (setq switches (list switches))) 129 (unless (listp switches) (setq switches (list switches)))
123 (or buf (setq buf (get-buffer-create "*Diff*"))) 130 (or buf (setq buf (get-buffer-create "*Diff*")))
131 (when (eq 'check diff-use-labels)
132 (setq diff-use-labels
133 (with-temp-buffer
134 (when (ignore-errors (call-process diff-command nil t nil "--help"))
135 (if (search-backward "--label" nil t) t)))))
124 (let* ((old-alt (diff-file-local-copy old)) 136 (let* ((old-alt (diff-file-local-copy old))
125 (new-alt (diff-file-local-copy new)) 137 (new-alt (diff-file-local-copy new))
126 (command 138 (command
@@ -130,11 +142,14 @@ specified in the variable `diff-switches' are passed to the diff command."
130 ,@switches 142 ,@switches
131 ,@(mapcar #'shell-quote-argument 143 ,@(mapcar #'shell-quote-argument
132 (nconc 144 (nconc
133 (when (or old-alt new-alt) 145 (and (or old-alt new-alt)
134 (list "-L" (if (stringp old) 146 (eq diff-use-labels t)
135 old (prin1-to-string old)) 147 (list "--label"
136 "-L" (if (stringp new) 148 (if (stringp old) old
137 new (prin1-to-string new)))) 149 (prin1-to-string old))
150 "--label"
151 (if (stringp new) new
152 (prin1-to-string new))))
138 (list (or old-alt old) 153 (list (or old-alt old)
139 (or new-alt new))))) 154 (or new-alt new)))))
140 " ")) 155 " "))