unicode-internal-commit: fixed bugs in ordering of charset-tag lists
Ben Wing
ben at xemacs.org
Tue Mar 23 08:18:43 EDT 2010
changeset: 5182:bdafc385da04
branch: ben-unicode-internal
user: Ben Wing <ben at xemacs.org>
date: Sat Feb 27 06:44:31 2010 -0600
files: lisp/ChangeLog lisp/mule/mule-charset.el
description:
fixed bugs in ordering of charset-tag lists
-------------------- ChangeLog entries follow: --------------------
lisp/ChangeLog addition:
2010-02-27 Ben Wing <ben at xemacs.org>
* mule/mule-charset.el:
* mule/mule-charset.el (charset-tag-property): New.
* mule/mule-charset.el (charset-tag-properties): New.
* mule/mule-charset.el (charset-tag-to-charset-list):
Add a couple of functions `charset-tag-property' and
`charset-tag-properties'. Modify charset-tag-to-charset-list to
use these functions. Also use :from-end property to
`remove-duplicates' so that result is "stable" in that later extra
elements rather than earlier ones get deleted. Also reverse the
order of charsets associated with a tag so that it matches the
order that charsets were added. (Not strictly necessary but principle
of least surprised.)
diff -r ef4cd339aa09 -r bdafc385da04 lisp/ChangeLog
--- a/lisp/ChangeLog Sat Feb 27 03:56:34 2010 -0600
+++ b/lisp/ChangeLog Sat Feb 27 06:44:31 2010 -0600
@@ -1,3 +1,18 @@
+2010-02-27 Ben Wing <ben at xemacs.org>
+
+ * mule/mule-charset.el:
+ * mule/mule-charset.el (charset-tag-property): New.
+ * mule/mule-charset.el (charset-tag-properties): New.
+ * mule/mule-charset.el (charset-tag-to-charset-list):
+ Add a couple of functions `charset-tag-property' and
+ `charset-tag-properties'. Modify charset-tag-to-charset-list to
+ use these functions. Also use :from-end property to
+ `remove-duplicates' so that result is "stable" in that later extra
+ elements rather than earlier ones get deleted. Also reverse the
+ order of charsets associated with a tag so that it matches the
+ order that charsets were added. (Not strictly necessary but principle
+ of least surprised.)
+
2010-02-27 Ben Wing <ben at xemacs.org>
* mule/latin.el (code):
diff -r ef4cd339aa09 -r bdafc385da04 lisp/mule/mule-charset.el
--- a/lisp/mule/mule-charset.el Sat Feb 27 03:56:34 2010 -0600
+++ b/lisp/mule/mule-charset.el Sat Feb 27 06:44:31 2010 -0600
@@ -384,6 +384,14 @@
(if (charset-tag-full-p tag) (list tag)
(gethash tag charset-tag-short-to-full-mapping)))
+(defun charset-tag-property (tag property)
+ "Return a property of a charset tag."
+ (getf (charset-tag-properties tag) property))
+
+(defun charset-tag-properties (tag)
+ "Return the list of properties of a charset tag."
+ (gethash tag charset-tag-to-properties-mapping))
+
(defun* define-charset-tag (tag &key list parent function doc-string)
"Define a charset tag.
PARENT specifies the parent(s) of the tag. PARENT can be a symbol or list
@@ -491,8 +499,7 @@
((= 1 (length full-tags))
;; If there's only one, then:
(let* ((full-tag (first full-tags))
- (props (gethash full-tag
- charset-tag-to-properties-mapping))
+ (props (charset-tag-properties full-tag))
(list (getf props 'list)))
;; 1. If a list tag, recurse over the elements of the
;; list.
@@ -504,13 +511,19 @@
(loop for par in (getf props 'parent)
append (charset-tag-to-charset-list par))))
;; ... then add charsets for the tag itself.
- (append (gethash full-tag
- charset-tag-to-charset-mapping)
+ ;; Technically the order of these is undefined,
+ ;; but we may as well make it agree with the
+ ;; order the charsets are added, so it is halfway
+ ;; reasonable.
+ (append (reverse
+ (gethash full-tag
+ charset-tag-to-charset-mapping))
ancestor-charsets)))))
(t
;; Otherwise, loop over all full tags.
(loop for full-tag in full-tags
- append (charset-tag-to-charset-list full-tag)))))))))
+ append (charset-tag-to-charset-list full-tag)))))
+ :from-end t))))
(defun register-charset-tags-1 (charset full-tag)
;; Actually make a note of this CHARSET/FULL-TAG combination.
More information about the XEmacs-Patches
mailing list