From: yamaoka Date: Fri, 21 Dec 2001 07:29:16 +0000 (+0000) Subject: * mu-register.el (mu-cite-load-registration-file): Reverted. I've got XEmacs X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a42a3ab34e92508ffafa9b9925d26a64ef2e9b04;p=elisp%2Fmu-cite.git * mu-register.el (mu-cite-load-registration-file): Reverted. I've got XEmacs wrong that it does'nt support the coding system magic cookie. However it has been working since XEmacs 21.2.21. Users can avoid mis-decoding a file by setting the value of the option `mu-registration-file-coding-system-for-read' properly even if they are using one of old (X)Emacsen. (mu-registration-file-coding-system-for-read): Fix a doc-string. --- diff --git a/ChangeLog b/ChangeLog index 8cd5f18..0c96b7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-12-21 Katsumi Yamaoka + + * mu-register.el (mu-cite-load-registration-file): Reverted. I've + got XEmacs wrong that it does'nt support the coding system magic + cookie. However it has been working since XEmacs 21.2.21. Users + can avoid mis-decoding a file by setting the value of the option + `mu-registration-file-coding-system-for-read' properly even if + they are using one of old (X)Emacsen. + (mu-registration-file-coding-system-for-read): Fix a doc-string. + 2001-08-29 Katsumi Yamaoka * mu-register.el (mu-cite-load-registration-file): Retry to read diff --git a/mu-register.el b/mu-register.el index e0cee98..f11fa22 100644 --- a/mu-register.el +++ b/mu-register.el @@ -63,14 +63,18 @@ for writing a file." "*Name of the variable to register citation prefix strings.") (defvar mu-registration-file-coding-system-for-read nil - "*Coding-system used when reading a registration file. It is strongly -recommended that you do not set this option if you have no particular -reason.") + "*Coding-system used when reading a registration file. Normally, you +have no need to set this option. If you have many friends in various +countries and the file contains their names in various languages, you +may avoid mis-decoding them by setting this option to `iso-2022-7bit' +or the other universal coding-system. Note that when you change this +value, you should save the file manually using the same coding-system +in advance.") (defvar mu-registration-file-coding-system nil "Internal variable used to keep a default coding-system for writing a current registration file. The value will be renewed whenever a -registration id read.") +registration file is read.") (defvar mu-register-history nil) @@ -81,47 +85,24 @@ registration id read.") (defun mu-cite-load-registration-file () (if (file-readable-p mu-registration-file) (with-temp-buffer + (set-buffer-multibyte t) (if mu-registration-file-coding-system-for-read (insert-file-contents-as-coding-system mu-registration-file-coding-system-for-read mu-registration-file) (insert-file-contents mu-registration-file)) - (let (exp) - (if (or (condition-case nil - (progn - (setq exp (read (current-buffer))) - t) - (error nil)) - ;; Under XEmacs, the function `insert-file-contents' - ;; does not handle the coding-system magic cookie. - (progn - (insert-file-contents-as-raw-text mu-registration-file - nil 0 3000 t) - (goto-char (point-min)) - (if (looking-at "\ -^[^\n]*-\\*-[^\n]*coding: \\([^\t\n ;]+\\)[^\n]*-\\*-") - (progn - (insert-file-contents-as-coding-system - (intern (match-string 1)) mu-registration-file - nil nil nil t) - (goto-char (point-min)) - (condition-case nil - (progn - (setq exp (read (current-buffer))) - t) - (error nil)))))) - (progn - (setq mu-registration-file-coding-system - (static-cond - ((boundp 'buffer-file-coding-system) - (symbol-value 'buffer-file-coding-system)) - ((boundp 'file-coding-system) - (symbol-value 'file-coding-system)) - (t - nil))) - (or (eq (car (cdr exp)) mu-registration-symbol) - (setcar (cdr exp) mu-registration-symbol)) - (eval exp)))))) + (setq mu-registration-file-coding-system + (static-cond + ((boundp 'buffer-file-coding-system) + (symbol-value 'buffer-file-coding-system)) + ((boundp 'file-coding-system) + (symbol-value 'file-coding-system)) + (t + nil))) + (let ((exp (read (current-buffer)))) + (or (eq (car (cdr exp)) mu-registration-symbol) + (setcar (cdr exp) mu-registration-symbol)) + (eval exp)))) (or (boundp mu-registration-symbol) (set mu-registration-symbol nil)))