From fc093a9a4f5649e8240b8410dc6a3c28d7e98f81 Mon Sep 17 00:00:00 2001 From: ueno Date: Fri, 5 Nov 2004 04:42:07 +0000 Subject: [PATCH] * riece-alias.el (riece-alias-alternate-separator): New user option. (riece-alias-use-atmark): Abolished. (riece-alias-escape-alternate-separator): Renamed from riece-alias-escape-atmark; use riece-alias-alternate-separator instead of hard-coded "@". (riece-alias-abbrev-alternate-separator): Renamed from riece-alias-abbrev-atmark; use riece-alias-alternate-separator instead of hard-coded "@". (riece-alias-expand-alternate-separator): Renamed from riece-alias-expand-atmark; use riece-alias-alternate-separator instead of hard-coded "@". --- lisp/ChangeLog | 15 ++++++++++++++ lisp/riece-alias.el | 55 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 50 insertions(+), 20 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c3394dc..a3a3aae 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,20 @@ 2004-11-05 Daiki Ueno + * riece-alias.el (riece-alias-alternate-separator): New user + option. + (riece-alias-use-atmark): Abolished. + (riece-alias-escape-alternate-separator): Renamed from + riece-alias-escape-atmark; use riece-alias-alternate-separator + instead of hard-coded "@". + (riece-alias-abbrev-alternate-separator): Renamed from + riece-alias-abbrev-atmark; use riece-alias-alternate-separator + instead of hard-coded "@". + (riece-alias-expand-alternate-separator): Renamed from + riece-alias-expand-atmark; use riece-alias-alternate-separator + instead of hard-coded "@". + +2004-11-05 Daiki Ueno + * riece-alias.el (riece-alias-abbrev-atmark): Don't append "@" to a channel on default server. diff --git a/lisp/riece-alias.el b/lisp/riece-alias.el index 7b94277..0575db8 100644 --- a/lisp/riece-alias.el +++ b/lisp/riece-alias.el @@ -50,9 +50,9 @@ :type 'boolean :group 'riece-alias) -(defcustom riece-alias-use-atmark nil - "If non-nil, use atmark to separate prefix and server." - :type 'boolean +(defcustom riece-alias-alternate-separator nil + "A string to separate prefix and server." + :type '(choice (const nil) string) :group 'riece-alias) (defcustom riece-alias-alist nil @@ -79,31 +79,41 @@ nil nil string) string)) -(defun riece-alias-escape-atmark (string) +(defun riece-alias-escape-alternate-separator (string) (let ((index 0)) - (while (string-match "@" string index) + (while (string-match (regexp-quote riece-alias-alternate-separator) + string index) (setq index (1+ (match-end 0)) - string (replace-match "@@" nil nil string))) + string (replace-match (concat riece-alias-alternate-separator + riece-alias-alternate-separator) + nil t string))) string)) -(defun riece-alias-abbrev-atmark (string) +(defun riece-alias-abbrev-alternate-separator (string) (if (string-match " " string) (let ((prefix (substring string 0 (match-beginning 0))) (server (substring string (match-end 0)))) - (concat (riece-alias-escape-atmark prefix) "@" - (riece-alias-escape-atmark server))) - (riece-alias-escape-atmark string))) + (concat (riece-alias-escape-alternate-separator prefix) + riece-alias-alternate-separator + (riece-alias-escape-alternate-separator server))) + (riece-alias-escape-alternate-separator string))) -(defun riece-alias-expand-atmark (string) +(defun riece-alias-expand-alternate-separator (string) (let ((index 0) prefix server length) (while (and (null prefix) - (string-match "@+" string index)) + (string-match + (concat (regexp-quote riece-alias-alternate-separator) "+") + string index)) (setq length (- (match-end 0) (match-beginning 0)) - string (replace-match (make-string (/ length 2) ?@) - nil nil string) + string (replace-match + (mapconcat #'identity + (make-list (/ length 2) + riece-alias-alternate-separator) + "") + nil t string) index (+ (match-beginning 0) (/ length 2))) (unless (zerop (% length 2)) (setq prefix (substring string 0 index)))) @@ -112,16 +122,21 @@ (setq server (substring string index) index 0) (if (equal server "") - (while (string-match "@@" server index) - (setq server (replace-match "@" nil nil server) + (while (string-match (regexp-quote + (concat riece-alias-alternate-separator + riece-alias-alternate-separator)) + server index) + (setq server (replace-match + riece-alias-alternate-separator + nil t server) index (1- (match-end 0)))) (concat prefix " " server))))) (defun riece-alias-abbrev-identity-string (string) (if riece-alias-enable-percent-hack (setq string (riece-alias-abbrev-percent-hack string))) - (if riece-alias-use-atmark - (setq string (riece-alias-abbrev-atmark string))) + (if riece-alias-alternate-separator + (setq string (riece-alias-abbrev-alternate-separator string))) (let ((alist riece-alias-alist)) (catch 'done (while alist @@ -133,8 +148,8 @@ (defun riece-alias-expand-identity-string (string) (if riece-alias-enable-percent-hack (setq string (riece-alias-expand-percent-hack string))) - (if riece-alias-use-atmark - (setq string (riece-alias-expand-atmark string))) + (if riece-alias-alternate-separator + (setq string (riece-alias-expand-alternate-separator string))) (let ((alist riece-alias-alist)) (catch 'done (while alist -- 1.7.10.4