From: yamaoka Date: Fri, 3 Aug 2001 04:09:30 +0000 (+0000) Subject: * mu-register.el (mu-cite-save-registration-file): Use X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1489c16a70cd313c85c97593479053f4c03eb3b9;p=elisp%2Fmu-cite.git * mu-register.el (mu-cite-save-registration-file): Use `mu-registration-file-coding-system-for-write' for writing a file. (mu-registration-file-coding-system-for-read): Use `defvar' instead of `defcustom' to define it. (mu-registration-file-coding-system-for-write): New user option. --- diff --git a/ChangeLog b/ChangeLog index 3372440..6ac01fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-08-03 Katsumi Yamaoka + + * mu-register.el (mu-cite-save-registration-file): Use + `mu-registration-file-coding-system-for-write' for writing a file. + (mu-registration-file-coding-system-for-read): Use `defvar' + instead of `defcustom' to define it. + (mu-registration-file-coding-system-for-write): New user option. + 2001-05-23 Katsumi Yamaoka * mu-cite.el (fill-column-for-fill-cited-region): Add a diff --git a/NEWS b/NEWS index e6d0179..4bb4fcc 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,15 @@ MU-CITE NEWS -- history of major-changes. -Copyright (C) 1999 Free Software Foundation, Inc. +Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. * Changes in MU-CITE 8.2 ======================== +** New user option `mu-registration-file-coding-system-for-write' +which is used when writing a registration file. The default value is +`iso-2022-7bit'. Note that you should never set the value of the +variable `mu-registration-file-coding-system-for-read' (which was +formerly customizable) if you have no particular reason. + ** MU-CITE now supports X-Cite-Me header as well as X-Attribution. ** New user option `fill-column-for-fill-cited-region' specifies an diff --git a/mu-register.el b/mu-register.el index 46167de..911b007 100644 --- a/mu-register.el +++ b/mu-register.el @@ -1,6 +1,6 @@ ;;; mu-register.el --- registration feature of mu-cite - -;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc. +;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001 +;; Free Software Foundation, Inc. ;; Author: MINOURA Makoto ;; MORIOKA Tomohiko @@ -45,8 +45,13 @@ :type 'integer :group 'mu-cite) -(defcustom mu-registration-file-coding-system-for-read nil - "Coding system used when reading a registration file." +(defcustom mu-registration-file-coding-system-for-write + (static-if (boundp 'MULE) + '*iso-2022-jp* + 'iso-2022-7bit) + "Coding-system used when writing a registration file. If you set this +to nil, the value of `mu-registration-file-coding-system' will be used +for writing a file." :group 'mu-cite) (defcustom mu-cite-allow-null-string-registration nil @@ -57,8 +62,15 @@ (defvar mu-registration-symbol 'mu-citation-name-alist "*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.") + (defvar mu-registration-file-coding-system nil - "Coding system used when writing a current registration file.") + "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.") (defvar mu-register-history nil) @@ -91,31 +103,36 @@ (defun mu-cite-save-registration-file () (with-temp-buffer - (insert ";;; " (file-name-nondirectory mu-registration-file) "\n") - (insert ";;; This file is generated automatically by mu-cite " - mu-cite-version "\n\n") - (insert "(setq " - (symbol-name mu-registration-symbol) - "\n '(") - (insert (mapconcat - (function - (lambda (elem) - (format "(%s . %s)" - (prin1-to-string - (mu-cite-remove-text-properties (car elem))) - (prin1-to-string - (mu-cite-remove-text-properties (cdr elem)))))) - (symbol-value mu-registration-symbol) "\n ")) - (insert "\n ))\n\n") - (insert ";;; " - (file-name-nondirectory mu-registration-file) - " ends here\n") - (write-region-as-coding-system mu-registration-file-coding-system - (point-min)(point-max) - mu-registration-file nil 'nomsg) - (condition-case nil - (set-file-modes mu-registration-file mu-registration-file-modes) - (error nil)))) + (set-buffer-multibyte t) + (let ((name (file-name-nondirectory mu-registration-file)) + (coding-system (or mu-registration-file-coding-system-for-write + mu-registration-file-coding-system))) + (insert (format "\ +;;; %s -*- mode: emacs-lisp; coding: %s -*- +;; This file is generated automatically by MU-CITE v%s. + +" + name coding-system mu-cite-version)) + (insert "(setq " + (symbol-name mu-registration-symbol) + "\n '(") + (insert (mapconcat + (function + (lambda (elem) + (format "(%s . %s)" + (prin1-to-string + (mu-cite-remove-text-properties (car elem))) + (prin1-to-string + (mu-cite-remove-text-properties (cdr elem)))))) + (symbol-value mu-registration-symbol) "\n\t")) + (insert "))\n\n") + (insert ";;; " name " ends here\n") + (write-region-as-coding-system coding-system + (point-min) (point-max) + mu-registration-file nil 'nomsg) + (condition-case nil + (set-file-modes mu-registration-file mu-registration-file-modes) + (error nil))))) ;;; @ database accessors