unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18824: split diff-check-labels off diff-no-select
@ 2014-10-25  9:17 Ivan Shmakov
  2014-10-26  2:41 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Ivan Shmakov @ 2014-10-25  9:17 UTC (permalink / raw)
  To: 18824

[-- Attachment #1: Type: text/plain, Size: 394 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/diff, Size: 1265 bytes --]

--- 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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: Type: text/emacs-lisp, Size: 682 bytes --]

(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)))

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-06-25 21:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-25  9:17 bug#18824: split diff-check-labels off diff-no-select Ivan Shmakov
2014-10-26  2:41 ` Stefan Monnier
2014-10-27 10:25   ` bug#18850: smerge-mode: use diff-check-labels Ivan Shmakov
2014-10-27 10:33     ` Ivan Shmakov
2014-10-27 13:32       ` Stefan Monnier
2014-10-27 13:36         ` Ivan Shmakov
2014-10-27 17:12           ` Stefan Monnier
2014-10-28  9:19             ` Ivan Shmakov
2014-10-28 13:44               ` Stefan Monnier
2016-02-23 12:03       ` Lars Ingebrigtsen
2019-06-25 21:22       ` Lars Ingebrigtsen
2014-11-21 10:57     ` bug#18850: (ping) Emacs bugs with patches? Ivan Shmakov
2016-02-23 12:05 ` bug#18824: split diff-check-labels off diff-no-select Lars Ingebrigtsen
2019-06-25 21:18 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).