1 new commit in xemacs-base:
https://bitbucket.org/xemacs/xemacs-base/commits/956c7e5673fe/
Changeset: 956c7e5673fe
User: Jerry James
Date: 2014-08-10 03:55:05
Summary: Implement assoc-string (in Lisp, versus the C implementation used in Emacs).
See <CAHCOHQk9m6pmDz9HSVoWdGZpvzVc6Y1gEk5m6UNF15b0VwGuDQ(a)mail.gmail.com> in
xemacs-patches.
Affected #: 2 files
diff -r 06f247e269bfbba4b2944ab529e846dfab7eae2e -r
956c7e5673fe0fa42bfd0733fe425127b92d46ac ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-08-04 Jerry James <james(a)xemacs.org>
+
+ * subr-more.el (assoc-string): New function from GNU Emacs.
+
2014-05-15 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 2.41 released.
diff -r 06f247e269bfbba4b2944ab529e846dfab7eae2e -r
956c7e5673fe0fa42bfd0733fe425127b92d46ac subr-more.el
--- a/subr-more.el
+++ b/subr-more.el
@@ -171,4 +171,28 @@
(progn ,@body)
(error (message "Error: %S" ,err) nil))))
+;;;###autoload
+(defun assoc-string (key list &optional case-fold)
+ "Like `assoc' but specifically for strings (and symbols).
+
+This returns the first element of LIST whose car matches the string or
+symbol KEY, or NIL if no match exists. When performing the comparison,
+symbols are first converted to strings. If the optional arg CASE-FOLD
+is non-nil, case is ignored.
+
+Unlike `assoc', KEY can also match an entry in LIST consisting of a
+single string, rather than a cons cell whose car is a string."
+ (when (symbolp key)
+ (setq key (symbol-name key)))
+ (let* ((tail list) elt elt2 elt3 result)
+ (while (and (null result) tail)
+ (setq elt (car tail)
+ elt2 (if (consp elt) (car elt) elt)
+ elt3 (if (symbolp elt2) (symbol-name elt2) elt2)
+ result (and (stringp elt3)
+ (eq (compare-strings elt3 0 nil key 0 nil case-fold) t)
+ elt)
+ tail (cdr tail)))
+ result))
+
;;; subr-more.el ends here
Repository URL:
https://bitbucket.org/xemacs/xemacs-base/
--
This is a commit notification from
bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches