* riece-identity.el: Don't require 'riece-compat.
authorDaiki Ueno <ueno@unixuser.org>
Wed, 17 Dec 2003 00:28:04 +0000 (00:28 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Wed, 17 Dec 2003 00:28:04 +0000 (00:28 +0000)
(riece-identity-prefix-case-table): Abolish.
(riece-identity-prefix-case-pair-alist): New constant.
(riece-identity-canonicalize-prefix): Don't use case-table.

* riece-emacs.el (riece-set-case-syntax-pair): Abolish.
(riece-copy-case-table): Abolish.
* riece-xmacs.el (riece-set-case-syntax-pair): Abolish.
(riece-copy-case-table): Abolish.

lisp/ChangeLog
lisp/riece-emacs.el
lisp/riece-identity.el
lisp/riece-xemacs.el

index 9c4371d..64bd3e8 100644 (file)
@@ -1,3 +1,15 @@
+2003-12-17  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-identity.el: Don't require 'riece-compat.
+       (riece-identity-prefix-case-table): Abolish.
+       (riece-identity-prefix-case-pair-alist): New constant.
+       (riece-identity-canonicalize-prefix): Don't use case-table.
+
+       * riece-emacs.el (riece-set-case-syntax-pair): Abolish.
+       (riece-copy-case-table): Abolish.
+       * riece-xmacs.el (riece-set-case-syntax-pair): Abolish.
+       (riece-copy-case-table): Abolish.
+
 2003-12-15  Daiki Ueno  <ueno@unixuser.org>
 
        * riece-options.el: Require 'riece-version.
index bb03c31..825ee57 100644 (file)
 
 ;;; Code:
 
-(defalias 'riece-set-case-syntax-pair
-  'set-case-syntax-pair)
-
-(defalias 'riece-copy-case-table
-  'copy-case-table)
-
 ;;; stolen (and renamed) from gnus-ems.el.
 ;;; In GNU Emacs, user can intercept whole mouse tracking events by
 ;;; assigning [mouse-X].  In XEmacs, however, which causes different
index f7a48cb..89e0e21 100644 (file)
 
 (require 'riece-globals)
 (require 'riece-coding)
-(require 'riece-compat)                        ;riece-set-case-syntax-pair
 
 (defvar riece-abbrev-identity-string-function nil)
 (defvar riece-expand-identity-string-function nil)
 
-(defvar riece-identity-prefix-case-table
-  (let ((table (riece-copy-case-table (standard-case-table))))
-    (riece-set-case-syntax-pair ?\[ ?{ table)
-    (riece-set-case-syntax-pair ?\] ?} table)
-    (riece-set-case-syntax-pair ?\\ ?| table)
-    (riece-set-case-syntax-pair ?~ ?^ table)
-    table))
-    
+(defconst riece-identity-prefix-case-pair-alist
+  '((?\[ . ?{)
+    (?\] . ?})
+    (?\\ . ?|)
+    (?~ . ?^))
+  "An alist used to canonicalize identity-prefix.
+RFC2812, 2.2 \"Character codes\" says:
+   Because of IRC's Scandinavian origin, the characters {}|^ are
+   considered to be the lower case equivalents of the characters []\~,
+   respectively. This is a critical issue when determining the
+   equivalence of two nicknames or channel names.")
+
 (defun riece-identity-prefix (identity)
   "Return the component sans its server from IDENTITY."
   (aref identity 0))
        (riece-identity-server ident2))))
 
 (defun riece-identity-canonicalize-prefix (prefix)
-  "Canonicalize identity PREFIX.
-This function downcases PREFIX with Scandinavian alphabet rule.
-
-RFC2812, 2.2 \"Character codes\" says:
-   Because of IRC's Scandinavian origin, the characters {}|^ are
-   considered to be the lower case equivalents of the characters []\~,
-   respectively. This is a critical issue when determining the
-   equivalence of two nicknames or channel names."
-  (let ((old-table (current-case-table)))
-    (unwind-protect
-       (progn
-         (set-case-table riece-identity-prefix-case-table)
-         (downcase prefix))
-      (set-case-table old-table))))
+  "Canonicalize identity PREFIX."
+  (let ((i 0)
+       c)
+    (setq prefix (copy-sequence prefix))
+    (while (< i (length prefix))
+      (if (setq c (cdr (assq (aref prefix i)
+                            riece-identity-prefix-case-pair-alist)))
+         (aset prefix i c))
+      (setq i (1+ i)))
+    prefix))
 
 (defun riece-identity-equal-no-server (prefix1 prefix2)
   "Return t, if IDENT1 and IDENT2 is equal without server part."
index d1ea150..1bab726 100644 (file)
 (defalias 'riece-simplify-mode-line-format
   'riece-xemacs-simplify-modeline-format)
 
-(if (fboundp 'put-case-table-pair)
-    (defalias 'riece-set-case-syntax-pair
-      'put-case-table-pair)
-  ;; In XEmacs 21.1, case-table is a list of strings.
-  (defun riece-set-case-syntax-pair (uc lc case-table)
-    (aset (car case-table) (char-to-int uc) lc)
-    (if (nth 1 case-table)
-       (aset (nth 1 case-table) (char-to-int lc) uc))
-    (if (nth 2 case-table)
-       (aset (nth 2 case-table) (char-to-int uc) lc))))
-
-(if (fboundp 'copy-case-table)
-    (defalias 'riece-copy-case-table 'copy-case-table)
-  ;; In XEmacs 21.1, case-table is a list of strings.
-  (defun riece-copy-case-table (case-table)
-    (mapcar #'copy-sequence case-table)))
-
 ;;; stolen (and renamed) from gnus-xmas.el.
 ;;; In GNU Emacs, user can intercept whole mouse tracking events by
 ;;; assigning [mouse-X].  In XEmacs, however, which causes different