all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ivan Shmakov <ivan@siamics.net>
To: 18824@debbugs.gnu.org
Subject: bug#18824: split diff-check-labels off diff-no-select
Date: Sat, 25 Oct 2014 09:17:49 +0000	[thread overview]
Message-ID: <87h9ysecea.fsf@violet.siamics.net> (raw)

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

             reply	other threads:[~2014-10-25  9:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-25  9:17 Ivan Shmakov [this message]
2014-10-26  2:41 ` bug#18824: split diff-check-labels off diff-no-select 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h9ysecea.fsf@violet.siamics.net \
    --to=ivan@siamics.net \
    --cc=18824@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.