diff options
author | Ivan Shmakov <ivan@siamics.net> | 2019-06-25 23:22:19 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2019-06-25 23:23:01 +0200 |
commit | 394282142563fe1341eba1845672e2412bf8c7d9 (patch) | |
tree | f52ca49d7cd4d28f0e60811bb2b11beb01b581e2 /lisp | |
parent | 4217398de3883cc8bc550f6ba33389e8ec85ad6e (diff) | |
download | emacs-394282142563fe1341eba1845672e2412bf8c7d9.tar.gz emacs-394282142563fe1341eba1845672e2412bf8c7d9.tar.bz2 emacs-394282142563fe1341eba1845672e2412bf8c7d9.zip |
Check labels in smerge-mode
* lisp/vc/diff.el (diff-check-labels): Separated out into its own
function (bug#18850)...
(diff-no-select): ... from here.
* lisp/vc/smerge-mode.el (smerge-diff): Use diff-check-labels.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/vc/diff.el | 15 | ||||
-rw-r--r-- | lisp/vc/smerge-mode.el | 10 |
2 files changed, 17 insertions, 8 deletions
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index 523be87bc49..5fa771f5f1e 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -123,6 +123,15 @@ Possible values are: (defvar diff-default-directory) +(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))) @@ -130,11 +139,7 @@ Possible values are: (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 diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index 6b1df6603df..f032b084167 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -44,6 +44,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(require 'diff) ;For diff-check-labels. (require 'diff-mode) ;For diff-refine. (require 'newcomment) @@ -1243,9 +1244,12 @@ spacing of the \"Lower\" chunk." (let ((status (apply 'call-process diff-command nil t nil (append smerge-diff-switches - (list "-L" (concat name1 "/" file) - "-L" (concat name2 "/" file) - file1 file2))))) + (and (diff-check-labels) + (list "--label" + (concat name1 "/" file) + "--label" + (concat name2 "/" file))) + (list file1 file2))))) (if (eq status 0) (insert "No differences found.\n")))) (goto-char (point-min)) (diff-mode) |