From: Katsumi Yamaoka Date: Wed, 23 Dec 2015 23:08:55 +0000 (+0000) Subject: Fix `gnus-union' so as to behave like `cl-union' X-Git-Tag: emacs-25.0.90~406 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9576e885ef33d08b53d8296e262e09d9deda9523;p=emacs.git 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. --- 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." (gnus-group-prepare-flat-list-dead (gnus-union not-in-list - (setq gnus-killed-list (sort gnus-killed-list 'string<))) + (setq gnus-killed-list (sort gnus-killed-list 'string<)) + :test 'equal) gnus-level-killed ?K regexp)) (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." (if (fboundp 'union) (defalias 'gnus-union 'union) - (defun gnus-union (l1 l2) - "Set union of lists L1 and L2." + (defun gnus-union (l1 l2 &rest keys) + "Set union of lists L1 and L2. +If KEYS contains the `:test' and `equal' pair, use `equal' to compare +items in lists, otherwise use `eq'." (cond ((null l1) l2) ((null l2) l1) ((equal l1 l2) l1) (t (or (>= (length l1) (length l2)) (setq l1 (prog1 l2 (setq l2 l1)))) - (while l2 - (or (member (car l2) l1) - (push (car l2) l1)) - (pop l2)) + (if (eq 'equal (plist-get keys :test)) + (while l2 + (or (member (car l2) l1) + (push (car l2) l1)) + (pop l2)) + (while l2 + (or (memq (car l2) l1) + (push (car l2) l1)) + (pop l2))) l1)))) (declare-function gnus-add-text-properties "gnus"