GNU bug report logs - #18824
split diff-check-labels off diff-no-select

Previous Next

Package: emacs;

Reported by: Ivan Shmakov <ivan <at> siamics.net>

Date: Sat, 25 Oct 2014 09:19:02 UTC

Severity: wishlist

Tags: fixed, patch

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ivan Shmakov <ivan <at> siamics.net>
To: 18824 <at> debbugs.gnu.org
Subject: bug#18824: split diff-check-labels off diff-no-select 
Date: Sat, 25 Oct 2014 09:17:49 +0000
[Message part 1 (text/plain, inline)]
Package:  emacs
Severity: wishlist
Tags:     patch

	Please provide a separate diff-check-labels function to allow
	for the code calling diff.el facilities to supply its own
	--label= arguments to diff in place of diff.el-generated ones.

	Possible patch, as well as the example usage, are MIMEd.

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A
[Message part 2 (text/diff, inline)]
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -121,6 +121,15 @@ Possible values are:
   nil   -- no, it does not
   check -- try to probe whether it does")
 
+(defun diff-check-labels (&optional force)
+  (if (not (or force (eq 'check diff-use-labels)))
+      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))))))
+
 (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)))
@@ -128,11 +137,7 @@ diff-no-select (old new &optional switches no-async buf)
   (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)))))
+  (diff-check-labels)
   (let* ((old-alt (diff-file-local-copy old))
 	 (new-alt (diff-file-local-copy new))
 	 (command
[Message part 3 (text/emacs-lisp, inline)]
(let ((old "old") (new "new")
      (target (get-buffer-create "*My Diff*"))
      (labels (and (diff-check-labels)
                   (mapcar 'shell-quote-argument
                           (list "--label"
                                 "*old revision*"
                                 "--label"
                                 "*new revision*")))))
  (if labels
      (let ((diff-use-labels nil)
            (sw (nconc labels
                       (if (listp diff-switches)
                           diff-switches
                         (list diff-switches)))))
        (diff-no-select old new switches nil target))
    (diff-no-select     old new nil      nil target)))

This bug report was last modified 5 years and 331 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.