summaryrefslogtreecommitdiff
path: root/lisp/proced.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/proced.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/proced.el')
-rw-r--r--lisp/proced.el11
1 files changed, 4 insertions, 7 deletions
diff --git a/lisp/proced.el b/lisp/proced.el
index db8bdb5ac80..24bc321f434 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1194,10 +1194,7 @@ Return `equal' if T1 equals T2. Return nil otherwise."
;;; Sorting
-(defsubst proced-xor (b1 b2)
- "Return the logical exclusive or of args B1 and B2."
- (and (or b1 b2)
- (not (and b1 b2))))
+(define-obsolete-function-alias 'proced-xor 'xor "27.1")
(defun proced-sort-p (p1 p2)
"Predicate for sorting processes P1 and P2."
@@ -1208,8 +1205,8 @@ Return `equal' if T1 equals T2. Return nil otherwise."
(k2 (cdr (assq (car sorter) (cdr p2)))))
;; if the attributes are undefined, we should really abort sorting
(if (and k1 k2)
- (proced-xor (funcall (nth 1 sorter) k1 k2)
- (nth 2 sorter))))
+ (xor (funcall (nth 1 sorter) k1 k2)
+ (nth 2 sorter))))
(let ((sort-list proced-sort-internal) sorter predicate k1 k2)
(catch 'done
(while (setq sorter (pop sort-list))
@@ -1219,7 +1216,7 @@ Return `equal' if T1 equals T2. Return nil otherwise."
(if (and k1 k2)
(funcall (nth 1 sorter) k1 k2)))
(if (not (eq predicate 'equal))
- (throw 'done (proced-xor predicate (nth 2 sorter)))))
+ (throw 'done (xor predicate (nth 2 sorter)))))
(eq t predicate)))))
(defun proced-sort (process-alist sorter descend)