summaryrefslogtreecommitdiff
path: root/lisp/vc/diff-mode.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2019-07-31 19:45:06 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2019-08-06 13:38:47 +0200
commitc676444a43e4634c1f98ec286b5bd9e46b23216b (patch)
tree8381c0ef5720a92b845808e8e885f6b5976ee0a1 /lisp/vc/diff-mode.el
parent1d8b5bc8dd543ada2f3c46436e43ea27faa3cd0e (diff)
downloademacs-c676444a43e4634c1f98ec286b5bd9e46b23216b.tar.gz
Add conditional operator xor to subr.el
Suggested by Oleh Krehel and implemented by Basil Contovounesios in the following thread: https://lists.gnu.org/archive/html/emacs-devel/2019-07/msg00547.html * lisp/array.el (xor): Move unused function from here... * lisp/subr.el: ...to here, and improve. * lisp/gnus/spam.el (spam-xor): * lisp/play/5x5.el (5x5-xor): * lisp/proced.el (proced-xor): * lisp/progmodes/idlwave.el (idlwave-xor): * lisp/vc/diff-mode.el (diff-xor): Define as obsolete aliases of, and replace all uses with, xor. * lisp/jsonrpc.el: Remove unused dependency on array.el. * lisp/org/org.el (org-xor): Move from here... * lisp/org/org-compat.el (org-xor): ...to here, as a compatibility shim for xor. * lisp/progmodes/idlw-shell.el (idlwave-shell-enable-all-bp): * lisp/simple.el (exchange-point-and-mark): * lisp/windmove.el (windmove-display-in-direction): Use xor. * lisp/strokes.el (strokes-xor): Remove commented-out xor implementation. * doc/lispref/control.texi (Control Structures): Extend menu entry for new combining condition. (Combining Conditions): * etc/NEWS (Lisp Changes): Document xor. * test/lisp/subr-tests.el (subr-test-xor): New test.
Diffstat (limited to 'lisp/vc/diff-mode.el')
-rw-r--r--lisp/vc/diff-mode.el12
1 files changed, 6 insertions, 6 deletions
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 81662cafeda..c4812e81d40 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -1771,7 +1771,7 @@ Whitespace differences are ignored."
(if (> (- (car forw) orig) (- orig (car back))) back forw)
(or back forw))))
-(defsubst diff-xor (a b) (if a (if (not b) a) b))
+(define-obsolete-function-alias 'diff-xor 'xor "27.1")
(defun diff-find-source-location (&optional other-file reverse noprompt)
"Find current diff location within the source file.
@@ -1791,7 +1791,7 @@ SRC and DST are the two variants of text as returned by `diff-hunk-text'.
SRC is the variant that was found in the buffer.
SWITCHED is non-nil if the patch is already applied."
(save-excursion
- (let* ((other (diff-xor other-file diff-jump-to-old-file))
+ (let* ((other (xor other-file diff-jump-to-old-file))
(char-offset (- (point) (diff-beginning-of-hunk t)))
;; Check that the hunk is well-formed. Otherwise diff-mode and
;; the user may disagree on what constitutes the hunk
@@ -1917,7 +1917,7 @@ With a prefix argument, REVERSE the hunk."
(insert (car new)))
;; Display BUF in a window
(set-window-point (display-buffer buf) (+ (car pos) (cdr new)))
- (diff-hunk-status-msg line-offset (diff-xor switched reverse) nil)
+ (diff-hunk-status-msg line-offset (xor switched reverse) nil)
(when diff-advance-after-apply-hunk
(diff-hunk-next))))))
@@ -1929,7 +1929,7 @@ With a prefix argument, try to REVERSE the hunk."
(pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched)
(diff-find-source-location nil reverse)))
(set-window-point (display-buffer buf) (+ (car pos) (cdr src)))
- (diff-hunk-status-msg line-offset (diff-xor reverse switched) t)))
+ (diff-hunk-status-msg line-offset (xor reverse switched) t)))
(defun diff-kill-applied-hunks ()
@@ -1966,7 +1966,7 @@ revision of the file otherwise."
(pop-to-buffer buf)
(goto-char (+ (car pos) (cdr src)))
(when buffer (next-error-found buffer (current-buffer)))
- (diff-hunk-status-msg line-offset (diff-xor reverse switched) t))))
+ (diff-hunk-status-msg line-offset (xor reverse switched) t))))
(defun diff-current-defun ()
@@ -2376,7 +2376,7 @@ fixed, visit it in a buffer."
(interactive "P")
(save-excursion
(goto-char (point-min))
- (let* ((other (diff-xor other-file diff-jump-to-old-file))
+ (let* ((other (xor other-file diff-jump-to-old-file))
(modified-buffers nil)
(style (save-excursion
(when (re-search-forward diff-hunk-header-re nil t)