aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatsumi Yamaoka2015-12-23 23:08:55 +0000
committerKatsumi Yamaoka2015-12-23 23:08:55 +0000
commit9576e885ef33d08b53d8296e262e09d9deda9523 (patch)
treec52afb9d57e4ef827b4aa9330e59cd7733a0d012
parent04dd5a502e76f11ca33550d0b03b28d3f65ee5b8 (diff)
downloademacs-9576e885ef33d08b53d8296e262e09d9deda9523.tar.gz
emacs-9576e885ef33d08b53d8296e262e09d9deda9523.zip
Fix `gnus-union' so as to behave like `cl-union'
* lisp/gnus/gnus-group.el (gnus-group-prepare-flat): Make gnus-union use `equal' to compare items in lists. * lisp/gnus/gnus-util.el (gnus-union): Make it behave like cl-union partially.
-rw-r--r--lisp/gnus/gnus-group.el3
-rw-r--r--lisp/gnus/gnus-util.el19
2 files changed, 15 insertions, 7 deletions
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index b1a4933ebf1..9f272f42587 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -1396,7 +1396,8 @@ if it is a string, only list groups matching REGEXP."
1396 (gnus-group-prepare-flat-list-dead 1396 (gnus-group-prepare-flat-list-dead
1397 (gnus-union 1397 (gnus-union
1398 not-in-list 1398 not-in-list
1399 (setq gnus-killed-list (sort gnus-killed-list 'string<))) 1399 (setq gnus-killed-list (sort gnus-killed-list 'string<))
1400 :test 'equal)
1400 gnus-level-killed ?K regexp)) 1401 gnus-level-killed ?K regexp))
1401 1402
1402 (gnus-group-set-mode-line) 1403 (gnus-group-set-mode-line)
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 40e2dcf92fd..6759c0715b7 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -1372,18 +1372,25 @@ Return the modified alist."
1372 1372
1373(if (fboundp 'union) 1373(if (fboundp 'union)
1374 (defalias 'gnus-union 'union) 1374 (defalias 'gnus-union 'union)
1375 (defun gnus-union (l1 l2) 1375 (defun gnus-union (l1 l2 &rest keys)
1376 "Set union of lists L1 and L2." 1376 "Set union of lists L1 and L2.
1377If KEYS contains the `:test' and `equal' pair, use `equal' to compare
1378items in lists, otherwise use `eq'."
1377 (cond ((null l1) l2) 1379 (cond ((null l1) l2)
1378 ((null l2) l1) 1380 ((null l2) l1)
1379 ((equal l1 l2) l1) 1381 ((equal l1 l2) l1)
1380 (t 1382 (t
1381 (or (>= (length l1) (length l2)) 1383 (or (>= (length l1) (length l2))
1382 (setq l1 (prog1 l2 (setq l2 l1)))) 1384 (setq l1 (prog1 l2 (setq l2 l1))))
1383 (while l2 1385 (if (eq 'equal (plist-get keys :test))
1384 (or (member (car l2) l1) 1386 (while l2
1385 (push (car l2) l1)) 1387 (or (member (car l2) l1)
1386 (pop l2)) 1388 (push (car l2) l1))
1389 (pop l2))
1390 (while l2
1391 (or (memq (car l2) l1)
1392 (push (car l2) l1))
1393 (pop l2)))
1387 l1)))) 1394 l1))))
1388 1395
1389(declare-function gnus-add-text-properties "gnus" 1396(declare-function gnus-add-text-properties "gnus"