From 2b3e524f9874d0c7ff8de24a696d52471cb7e3bd Mon Sep 17 00:00:00 2001 From: ueno Date: Tue, 19 Mar 2002 22:37:42 +0000 Subject: [PATCH] Synch up with liece-2_0. --- lisp/gettext.el | 31 +++++++++++++++++++++---------- lisp/liece-000.el | 4 ++-- lisp/liece-channel.el | 4 ++-- lisp/liece-compat.el | 5 +++++ lisp/liece-handle.el | 2 +- lisp/liece-nick.el | 4 ++-- 6 files changed, 33 insertions(+), 17 deletions(-) diff --git a/lisp/gettext.el b/lisp/gettext.el index a23a7d5..063c4cd 100644 --- a/lisp/gettext.el +++ b/lisp/gettext.el @@ -31,11 +31,18 @@ (eval-when-compile (require 'cl)) (require 'mcharset) +(require 'static) +(require 'poem) -(eval-and-compile +(eval-when-compile (autoload 'mime-content-type-parameter "mime-parse") (autoload 'mime-read-Content-Type "mime-parse")) +(static-if (fboundp 'string-to-list) + (defalias 'gettext-string-to-list 'string-to-list) + ;; Rely on `string-to-char-list' emulation is provided in poem. + (defalias 'gettext-string-to-list 'string-to-char-list)) + (defvar gettext-gmo-endian 1234) (defvar gettext-message-domain-to-catalog-alist nil) (defvar gettext-default-message-domain "emacs") @@ -108,15 +115,19 @@ (goto-char pos)) (nreverse strings))) -(defmacro gettext-parse-Content-Type (&optional header) - (require 'path-util) - (if (module-installed-p 'mime-parse) - (list 'with-temp-buffer - (list 'insert header) - '(mime-content-type-parameter - (mime-read-Content-Type) - "charset")) - 'gettext-default-mime-charset)) +(defun gettext-parse-Content-Type (&optional header) + "Return the MIME charset of PO file." + (with-temp-buffer + (insert header) + (if (require 'mime-parse nil 'noerror) + (mime-content-type-parameter (mime-read-Content-Type) "charset") + (goto-char (point-min)) + (if (re-search-forward + "^\"Content-Type: *text/plain;[ \t]*charset=\\([^\\]+\\)" + nil t) + (find-mime-charset-by-charsets + (list (buffer-substring (match-beginning 1) (match-end 1)))) + gettext-default-mime-charset)))) (defun gettext-mapcar* (function &rest args) "Apply FUNCTION to successive cars of all ARGS. diff --git a/lisp/liece-000.el b/lisp/liece-000.el index f7cc798..528e545 100644 --- a/lisp/liece-000.el +++ b/lisp/liece-000.el @@ -105,10 +105,10 @@ ((string-match "[^ ]* [^ ]* \\([^ ]+\\) \\(.*\\)" rest) (setq liece-supported-user-mode-alist (char-list-to-string-alist - (string-to-char-list (match-string 1 rest))) + (liece-string-to-list (match-string 1 rest))) liece-supported-channel-mode-alist (char-list-to-string-alist - (string-to-char-list (match-string 2 rest))))) + (liece-string-to-list (match-string 2 rest))))) (t (liece-insert-info liece-000-buffer (concat rest "\n")))))) diff --git a/lisp/liece-channel.el b/lisp/liece-channel.el index aecc8ec..3b7f8f9 100644 --- a/lisp/liece-channel.el +++ b/lisp/liece-channel.el @@ -137,7 +137,7 @@ (defmacro liece-channel-add-mode (mode &optional chnl) "Add MODE as char to CHNL." - `(let ((modes (string-to-char-list (or (liece-channel-get-modes ,chnl) + `(let ((modes (liece-string-to-list (or (liece-channel-get-modes ,chnl) "")))) (or (memq ,mode modes) (push ,mode modes)) @@ -146,7 +146,7 @@ (defmacro liece-channel-remove-mode (mode &optional chnl) "Remove MODE as char to CHNL." - `(let ((modes (string-to-char-list (or (liece-channel-get-modes ,chnl) + `(let ((modes (liece-string-to-list (or (liece-channel-get-modes ,chnl) "")))) (delq ,mode modes) (put (intern (or ,chnl liece-current-channel) liece-obarray) diff --git a/lisp/liece-compat.el b/lisp/liece-compat.el index 58568b2..7ed1a87 100644 --- a/lisp/liece-compat.el +++ b/lisp/liece-compat.el @@ -65,6 +65,11 @@ Otherwise, this function always returns false. (defalias 'liece-window-height 'window-displayed-height) (defalias 'liece-window-height 'window-height)) +(static-if (fboundp 'string-to-list) + (defalias 'liece-string-to-list 'string-to-list) + ;; Rely on `string-to-char-list' emulation is provided in poem. + (defalias 'liece-string-to-list 'string-to-char-list)) + (defalias 'liece-mode-line-buffer-identification 'identity) (defun liece-suppress-mode-line-format () diff --git a/lisp/liece-handle.el b/lisp/liece-handle.el index c47fbf8..e84f045 100644 --- a/lisp/liece-handle.el +++ b/lisp/liece-handle.el @@ -277,7 +277,7 @@ (when (string-match "\\([^ ]*\\) +" str) (setq mflag (match-string 1 str) marg (substring str (match-end 0)) - mflags (string-to-char-list mflag)) + mflags (liece-string-to-list mflag)) (while (string-match "^\\([^ ]*\\) +" marg) (setq margs (cons (match-string 1 marg) margs) marg (substring marg (match-end 0)))) diff --git a/lisp/liece-nick.el b/lisp/liece-nick.el index 570c47d..93dfe51 100644 --- a/lisp/liece-nick.el +++ b/lisp/liece-nick.el @@ -88,7 +88,7 @@ (defmacro liece-nick-add-mode (mode &optional nick) "Add MODE as char to NICK." `(let* ((n (intern ,nick liece-obarray)) - (modes (string-to-char-list (or (get n 'mode) "")))) + (modes (liece-string-to-list (or (get n 'mode) "")))) (put n 'mode (mapconcat #'char-to-string (or (memq ,mode modes) (cons ,mode modes)) "")))) @@ -96,7 +96,7 @@ (defmacro liece-nick-remove-mode (mode &optional nick) "Remove MODE as char to NICK." `(let* ((n (intern ,nick liece-obarray)) - (modes (string-to-char-list (or (get n 'mode) "")))) + (modes (liece-string-to-list (or (get n 'mode) "")))) (delq ,mode modes) (put n 'mode (mapconcat #'char-to-string modes "")))) -- 1.7.10.4