Apparently gnu emacs has this, and it's a comparatively easy thing to add,
so I thought it'd be worth trying to add. These are the diff lines
comparing with http://hg.debian.org/hg/xemacs/xemacs-beta
searching for changes
date: Mon Feb 25 04:45:41 2008 -0800
summary: * subr.el(add-to-list): add support for `compare-fn' to sync
diff -r 42711a251efd -r fa7844674ed2 lisp/subr.el
--- a/lisp/subr.el Fri Feb 15 13:11:56 2008 +0100
+++ b/lisp/subr.el Mon Feb 25 04:45:41 2008 -0800
＠＠ -390,19 +390,21 ＠＠ argument to `add-one-shot-hook'."
argument to `add-one-shot-hook'."
(add-one-shot-hook hook function append t))
-(defun add-to-list (list-var element &optional append)
+(defun add-to-list (list-var element &optional append compare-fn)
"Add to the value of LIST-VAR the element ELEMENT if it isn't there yet.
-The test for presence of ELEMENT is done with `equal'.
-If ELEMENT is added, it is added at the beginning of the list,
-unless the optional argument APPEND is non-nil, in which case
-ELEMENT is added at the end.
+The test for presence of ELEMENT is done with COMPARE-FN; if
+COMPARE-FN is nil, then it defaults to `equal'. If ELEMENT is added,
+it is added at the beginning of the list, unless the optional argument
+APPEND is non-nil, in which case ELEMENT is added at the end.
If you want to use `add-to-list' on a variable that is not defined
until a certain package is loaded, you should put the call to `add-to-list'
into a hook function that will be run only after loading the package.
`eval-after-load' provides one way to do this. In some cases
other hooks, such as major mode hooks, can do the job."
- (if (member element (symbol-value list-var))
+ (if (if (not compare-fn)
+ (member element (symbol-value list-var))
+ (member* element (symbol-value list-var) :test compare-fn))
diff -r fa7844674ed2 -r 513a4815ee5d lisp/ChangeLog
--- a/lisp/ChangeLog Mon Feb 25 04:45:41 2008 -0800
+++ b/lisp/ChangeLog Mon Feb 25 04:55:55 2008 -0800
＠＠ -1,3 +1,8 ＠＠ 2008-02-03 Aidan Kehoe <kehoea＠parhasa
+2008-02-25 bpalmer <bpalmer(a)gmail.com>
+ * subr.el(add-to-list): add support for `compare-fn' to sync with
2008-02-03 Aidan Kehoe <kehoea(a)parhasard.net>
* iso8859-1.el (ascii-case-table):
XEmacs-Patches mailing list