From: ueno Date: Mon, 27 Oct 2003 04:53:06 +0000 (+0000) Subject: * riece-identity.el (riece-identity-prefix-case-table): Use X-Git-Tag: riece-0_1_6~11 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f0708ec6ff7d8e7f8633ecb2d310b28ff44ac29;p=elisp%2Friece.git * riece-identity.el (riece-identity-prefix-case-table): Use riece-copy-case-table to define. * riece-xemacs.el (riece-set-case-syntax-pair): Workaround for XEmacs 21.1. (riece-copy-case-table): Ditto. * riece-emacs.el (riece-copy-case-table): New alias. * riece-globals.el (riece-channel-regexp): Use riece-make-interval-regexp to define. (riece-user-regexp): Ditto. * riece-compat.el (riece-make-interval-regexp): New function. --- diff --git a/lisp/riece-compat.el b/lisp/riece-compat.el index ef41c10..25d544e 100644 --- a/lisp/riece-compat.el +++ b/lisp/riece-compat.el @@ -59,6 +59,19 @@ (setq riece-read-passwd 'ange-ftp-read-passwd)))) (funcall riece-read-passwd prompt)) +(if (string-match "0\\{0\\}" "") + (defun riece-make-interval-regexp (regexp min &optional max) + (if max + (concat regexp (format "\\{%d,%d\\}" min max)) + (concat regexp (format "\\{%d\\}" min)))) + ;; Emacs 20.7 doesn't support \{...\} in regexps. + (defun riece-make-interval-regexp (regexp min &optional max) + (mapconcat #'identity + (nconc (make-list min regexp) + (if max + (make-list (- max min) (concat regexp "?")))) + ""))) + (provide 'riece-compat) ;;; riece-compat.el ends here diff --git a/lisp/riece-emacs.el b/lisp/riece-emacs.el index 00759b7..bb03c31 100644 --- a/lisp/riece-emacs.el +++ b/lisp/riece-emacs.el @@ -27,6 +27,9 @@ (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 diff --git a/lisp/riece-globals.el b/lisp/riece-globals.el index 73d60c0..852426a 100644 --- a/lisp/riece-globals.el +++ b/lisp/riece-globals.el @@ -24,11 +24,17 @@ ;;; Code: +(require 'riece-compat) ;riece-make-interval-regexp + ;;; Constants: (defconst riece-channel-regexp - "\\([+&#]\\|![A-Z0-9]\\{5\\}\\|!!\\)[^\0\7\r\n ,:]*\\(:[^\0\7\r\n ,:]*\\)?") + (concat "\\([+&#]\\|!" + (riece-make-interval-regexp "[A-Z0-9]" 5) + "\\|!!\\)[^\0\7\r\n ,:]*\\(:[^\0\7\r\n ,:]*\\)?")) + (defconst riece-user-regexp - "[][\\\\`_^{|}A-Za-z][][\\\\`_^{|}A-Za-z0-9-]\\{0,8\\}") + (concat "[][\\\\`_^{|}A-Za-z]" + (riece-make-interval-regexp "[][\\\\`_^{|}A-Za-z0-9-]" 0 8))) ;;; Global variables: (defvar riece-server-process-alist nil diff --git a/lisp/riece-identity.el b/lisp/riece-identity.el index c01c454..f7a48cb 100644 --- a/lisp/riece-identity.el +++ b/lisp/riece-identity.el @@ -32,7 +32,7 @@ (defvar riece-expand-identity-string-function nil) (defvar riece-identity-prefix-case-table - (let ((table (copy-case-table (standard-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) diff --git a/lisp/riece-xemacs.el b/lisp/riece-xemacs.el index 519b41a..d1ea150 100644 --- a/lisp/riece-xemacs.el +++ b/lisp/riece-xemacs.el @@ -49,8 +49,22 @@ (defalias 'riece-simplify-mode-line-format 'riece-xemacs-simplify-modeline-format) -(defalias 'riece-set-case-syntax-pair - 'put-case-table-pair) +(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