[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111731: Check whether diff supports
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111731: Check whether diff supports --label before using it |
Date: |
Mon, 11 Feb 2013 00:28:08 -0800 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111731
fixes bug: http://debbugs.gnu.org/11067
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Mon 2013-02-11 00:28:08 -0800
message:
Check whether diff supports --label before using it
* lisp/vc/diff.el (diff-use-labels): New variable.
(diff-no-select): Use --label rather than -L, and first
check that it is supported.
modified:
lisp/ChangeLog
lisp/vc/diff.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-02-11 01:50:45 +0000
+++ b/lisp/ChangeLog 2013-02-11 08:28:08 +0000
@@ -1,5 +1,9 @@
2013-02-11 Glenn Morris <address@hidden>
+ * vc/diff.el (diff-use-labels): New variable.
+ (diff-no-select): Use --label rather than -L, and first
+ check that it is supported. (Bug#11067)
+
* files.el (enable-dir-local-variables): New variable.
(hack-dir-local-variables): Respect enable-dir-local-variables.
* tutorial.el (help-with-tutorial):
=== modified file 'lisp/vc/diff.el'
--- a/lisp/vc/diff.el 2013-01-11 23:08:55 +0000
+++ b/lisp/vc/diff.el 2013-02-11 08:28:08 +0000
@@ -114,6 +114,13 @@
tempfile))
(file-local-copy file-or-buf)))
+(defvar diff-use-labels 'check
+ "Whether `diff-command' understands the \"--label\" option.
+Possible values are:
+ t -- yes, it does
+ nil -- no, it does not
+ check -- try to probe whether it does")
+
(defun diff-no-select (old new &optional switches no-async buf)
;; Noninteractive helper for creating and reverting diff buffers
(unless (bufferp new) (setq new (expand-file-name new)))
@@ -121,6 +128,11 @@
(or switches (setq switches diff-switches)) ; If not specified, use default.
(unless (listp switches) (setq switches (list switches)))
(or buf (setq buf (get-buffer-create "*Diff*")))
+ (when (eq 'check diff-use-labels)
+ (setq diff-use-labels
+ (with-temp-buffer
+ (when (ignore-errors (call-process diff-command nil t nil "--help"))
+ (if (search-backward "--label" nil t) t)))))
(let* ((old-alt (diff-file-local-copy old))
(new-alt (diff-file-local-copy new))
(command
@@ -130,11 +142,14 @@
,@switches
,@(mapcar #'shell-quote-argument
(nconc
- (when (or old-alt new-alt)
- (list "-L" (if (stringp old)
- old (prin1-to-string old))
- "-L" (if (stringp new)
- new (prin1-to-string new))))
+ (and (or old-alt new-alt)
+ (eq diff-use-labels t)
+ (list "--label"
+ (if (stringp old) old
+ (prin1-to-string old))
+ "--label"
+ (if (stringp new) new
+ (prin1-to-string new))))
(list (or old-alt old)
(or new-alt new)))))
" "))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111731: Check whether diff supports --label before using it,
Glenn Morris <=