Mercurial > hg > xemacs-beta
diff lisp/mu/mu-cite.el @ 32:e04119814345 r19-15b99
Import from CVS: tag r19-15b99
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:52:56 +0200 |
parents | d95e72db5c07 |
children | 7e54bd776075 |
line wrap: on
line diff
--- a/lisp/mu/mu-cite.el Mon Aug 13 08:52:30 2007 +0200 +++ b/lisp/mu/mu-cite.el Mon Aug 13 08:52:56 2007 +0200 @@ -6,7 +6,7 @@ ;; MINOURA Makoto <minoura@netlaputa.or.jp> ;; Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp> ;; Maintainer: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp> -;; Version: $Revision: 1.5 $ +;; Version: $Revision: 1.6 $ ;; Keywords: mail, news, citation ;; This file is part of MU (Message Utilities). @@ -54,7 +54,7 @@ ;;; (defconst mu-cite/RCS-ID - "$Id: mu-cite.el,v 1.5 1997/02/04 02:36:02 steve Exp $") + "$Id: mu-cite.el,v 1.6 1997/03/16 05:55:24 steve Exp $") (defconst mu-cite/version (get-version-string mu-cite/RCS-ID)) @@ -122,8 +122,7 @@ ;;; @ prefix registration ;;; -(defvar mu-cite/registration-file - (expand-file-name "~/.mu-cite.el") +(defvar mu-cite/registration-file (expand-file-name "~/.mu-cite.el") "*The name of the user environment file for mu-cite.") (defvar mu-cite/allow-null-string-registration nil @@ -132,7 +131,6 @@ (defvar mu-cite/registration-symbol 'mu-cite/citation-name-alist) (defvar mu-cite/citation-name-alist nil) -(load mu-cite/registration-file t t t) (or (eq 'mu-cite/citation-name-alist mu-cite/registration-symbol) (setq mu-cite/citation-name-alist (symbol-value mu-cite/registration-symbol)) @@ -148,31 +146,48 @@ (defun mu-cite/add-citation-name (name from) (setq mu-cite/citation-name-alist (put-alist from name mu-cite/citation-name-alist)) - (mu-cite/save-to-file) + (mu-cite/save-registration-file) ) -;; save to file -(defun mu-cite/save-to-file () - (let* ((filename mu-cite/registration-file) +;; load/save registration file +(defun mu-cite/load-registration-file () + (let* ((file mu-cite/registration-file) + (buffer (get-buffer-create " *mu-register*"))) + (if (file-readable-p file) + (unwind-protect + (save-excursion + (set-buffer buffer) + (erase-buffer) + (insert-file-contents file) + ;; (eval-buffer) + (eval-current-buffer)) + (kill-buffer buffer)) + ))) +(add-hook 'mu-cite-load-hook (function mu-cite/load-registration-file)) + +(defun mu-cite/save-registration-file () + (let* ((file mu-cite/registration-file) (buffer (get-buffer-create " *mu-register*"))) - (save-excursion - (set-buffer buffer) - (setq buffer-file-name filename) - (erase-buffer) - (insert - (format ";;; %s\n" (file-name-nondirectory filename))) - (insert - (format ";;; This file is generated automatically by mu-cite %s.\n\n" - mu-cite/version)) - (insert (format "(setq %s\n '(" mu-cite/registration-symbol)) - (insert (mapconcat - (function prin1-to-string) - mu-cite/citation-name-alist "\n ")) - (insert "\n ))\n\n") - (insert - (format ";;; %s ends here.\n" (file-name-nondirectory filename))) - (save-buffer)) - (kill-buffer buffer))) + (unwind-protect + (save-excursion + (set-buffer buffer) + (setq buffer-file-name file) + (erase-buffer) + (insert ";;; " (file-name-nondirectory file) "\n") + (insert ";;; This file is generated automatically by mu-cite " + mu-cite/version "\n\n") + (insert "(setq " + (symbol-name mu-cite/registration-symbol) + "\n '(") + (insert (mapconcat + (function prin1-to-string) + mu-cite/citation-name-alist "\n ")) + (insert "\n ))\n\n") + (insert ";;; " + (file-name-nondirectory file) + " ends here.\n") + (save-buffer)) + (kill-buffer buffer)))) ;;; @ item methods