-(defun mu-register/citation-name ()
- (let* ((from
- (rfc822/address-string
- (car (rfc822/parse-address
- (rfc822/lexical-analyze
- (mu-cite/get-value 'from))))))
- (fullname (mu-cite/get-value 'full-name))
- (return1
- (mu-register/get-citation-name from))
- (return))
- (if (null return1)
- (setq return1 fullname))
- (setq return
- (read-string "Citation name? "
- return1
- 'mu-register/minibuffer-history))
- (if (not (string-equal return return1))
- (let ((ans)
- (cursor-in-echo-area t))
- (while (null ans)
- (message (format "Register \"%s\" (y/n)? " return))
- (setq ans (read-event))
- (if (not (or (eq ans ?y)
- (eq ans ?n)))
- (setq ans nil)))
- (message "")
- (if (eq ans ?y)
- (mu-register/add-citation-name return from))))
- return))
-
-(defun mu-register/citation-name-quietly ()
- (let* ((from
- (rfc822/address-string
- (car (rfc822/parse-address
- (rfc822/lexical-analyze
- (mu-cite/get-value 'from))))))
- (fullname (mu-cite/get-value 'full-name))
- (return1
- (mu-register/get-citation-name from))
- return)
- (if (null return1)
- (progn
- (setq return
- (read-string "Citation name? "
- fullname
- 'mu-register/minibuffer-history))
-
- (if (not (string-equal return return1))
- (let ((ans)
- (cursor-in-echo-area t))
- (while (null ans)
- (message (format "Register \"%s\" (y/n)? " return))
- (setq ans (read-event))
- (if (not (or (eq ans ?y)
- (eq ans ?n)))
- (setq ans nil)))
- (message "")
- (if (eq ans ?y)
- (mu-register/add-citation-name return from)
- )
- ))
- )
- (setq return return1)
- )
- return))
-
-\f
-
-;;; @ Installation
+(defcustom mu-registration-file (expand-file-name "~/.mu-cite.el")
+ "The name of the user environment file for mu-cite."
+ :type 'file
+ :group 'mu-cite)
+
+(defcustom mu-registration-file-modes 384
+ "Mode bits of `mu-registration-file', as an integer."
+ :type 'integer
+ :group 'mu-cite)
+
+(defcustom mu-registration-file-coding-system-for-read nil
+ "Coding system used when reading a registration file."
+ :group 'mu-cite)
+
+(defcustom mu-cite-allow-null-string-registration nil
+ "If non-nil, null-string citation-name is registered."
+ :type 'boolean
+ :group 'mu-cite)
+
+(defvar mu-registration-symbol 'mu-citation-name-alist
+ "*Name of the variable to register citation prefix strings.")
+
+(defvar mu-registration-file-coding-system nil
+ "Coding system used when writing a current registration file.")
+
+(defvar mu-register-history nil)
+
+(static-when (featurep 'xemacs)
+ (define-obsolete-variable-alias
+ 'mu-cite/registration-file 'mu-registration-file)
+
+ (define-obsolete-variable-alias
+ 'mu-cite/allow-null-string-registration
+ 'mu-cite-allow-null-string-registration)
+
+ (define-obsolete-variable-alias
+ 'mu-cite/registration-symbol 'mu-registration-symbol)
+ )
+
+
+;;; @ load / save registration file
+;;;
+
+(defun mu-cite-load-registration-file ()
+ (if (file-readable-p mu-registration-file)
+ (with-temp-buffer
+ (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))
+ (setq mu-registration-file-coding-system
+ (static-if (<= emacs-major-version 19)
+ file-coding-system
+ buffer-file-coding-system))
+ (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)))
+
+(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 prin1-to-string)
+ (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))))
+
+
+;;; @ database accessors