Mercurial > hg > xemacs-beta
comparison lisp/mu/mu-cite.el @ 110:fe104dbd9147 r20-1b7
Import from CVS: tag r20-1b7
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:19:45 +0200 |
parents | 0d2f883870bc |
children | 8619ce7e4c50 |
comparison
equal
deleted
inserted
replaced
109:e183fc049578 | 110:fe104dbd9147 |
---|---|
4 | 4 |
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp> | 5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp> |
6 ;; MINOURA Makoto <minoura@netlaputa.or.jp> | 6 ;; MINOURA Makoto <minoura@netlaputa.or.jp> |
7 ;; Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp> | 7 ;; Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp> |
8 ;; Maintainer: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp> | 8 ;; Maintainer: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp> |
9 ;; Version: $Revision: 1.4 $ | 9 ;; Version: $Revision: 1.5 $ |
10 ;; Keywords: mail, news, citation | 10 ;; Keywords: mail, news, citation |
11 | 11 |
12 ;; This file is part of MU (Message Utilities). | 12 ;; This file is part of MU (Message Utilities). |
13 | 13 |
14 ;; This program is free software; you can redistribute it and/or | 14 ;; This program is free software; you can redistribute it and/or |
52 | 52 |
53 ;;; @ version | 53 ;;; @ version |
54 ;;; | 54 ;;; |
55 | 55 |
56 (defconst mu-cite/RCS-ID | 56 (defconst mu-cite/RCS-ID |
57 "$Id: mu-cite.el,v 1.4 1997/02/15 22:21:09 steve Exp $") | 57 "$Id: mu-cite.el,v 1.5 1997/03/16 03:05:20 steve Exp $") |
58 (defconst mu-cite/version (get-version-string mu-cite/RCS-ID)) | 58 (defconst mu-cite/version (get-version-string mu-cite/RCS-ID)) |
59 | 59 |
60 | 60 |
61 ;;; @ formats | 61 ;;; @ formats |
62 ;;; | 62 ;;; |
120 | 120 |
121 | 121 |
122 ;;; @ prefix registration | 122 ;;; @ prefix registration |
123 ;;; | 123 ;;; |
124 | 124 |
125 (defvar mu-cite/registration-file | 125 (defvar mu-cite/registration-file (expand-file-name "~/.mu-cite.el") |
126 (expand-file-name "~/.mu-cite.el") | |
127 "*The name of the user environment file for mu-cite.") | 126 "*The name of the user environment file for mu-cite.") |
128 | 127 |
129 (defvar mu-cite/allow-null-string-registration nil | 128 (defvar mu-cite/allow-null-string-registration nil |
130 "*If non-nil, null-string citation-name is registered.") | 129 "*If non-nil, null-string citation-name is registered.") |
131 | 130 |
132 (defvar mu-cite/registration-symbol 'mu-cite/citation-name-alist) | 131 (defvar mu-cite/registration-symbol 'mu-cite/citation-name-alist) |
133 | 132 |
134 (defvar mu-cite/citation-name-alist nil) | 133 (defvar mu-cite/citation-name-alist nil) |
135 (load mu-cite/registration-file t t t) | |
136 (or (eq 'mu-cite/citation-name-alist mu-cite/registration-symbol) | 134 (or (eq 'mu-cite/citation-name-alist mu-cite/registration-symbol) |
137 (setq mu-cite/citation-name-alist | 135 (setq mu-cite/citation-name-alist |
138 (symbol-value mu-cite/registration-symbol)) | 136 (symbol-value mu-cite/registration-symbol)) |
139 ) | 137 ) |
140 (defvar mu-cite/minibuffer-history nil) | 138 (defvar mu-cite/minibuffer-history nil) |
146 | 144 |
147 ;; register citation-name to the database | 145 ;; register citation-name to the database |
148 (defun mu-cite/add-citation-name (name from) | 146 (defun mu-cite/add-citation-name (name from) |
149 (setq mu-cite/citation-name-alist | 147 (setq mu-cite/citation-name-alist |
150 (put-alist from name mu-cite/citation-name-alist)) | 148 (put-alist from name mu-cite/citation-name-alist)) |
151 (mu-cite/save-to-file) | 149 (mu-cite/save-registration-file) |
152 ) | 150 ) |
153 | 151 |
154 ;; save to file | 152 ;; load/save registration file |
155 (defun mu-cite/save-to-file () | 153 (defun mu-cite/load-registration-file () |
156 (let* ((filename mu-cite/registration-file) | 154 (let* ((file mu-cite/registration-file) |
157 (buffer (get-buffer-create " *mu-register*"))) | 155 (buffer (get-buffer-create " *mu-register*"))) |
158 (save-excursion | 156 (if (file-readable-p file) |
159 (set-buffer buffer) | 157 (unwind-protect |
160 (setq buffer-file-name filename) | 158 (save-excursion |
161 (erase-buffer) | 159 (set-buffer buffer) |
162 (insert | 160 (erase-buffer) |
163 (format ";;; %s\n" (file-name-nondirectory filename))) | 161 (insert-file-contents file) |
164 (insert | 162 ;; (eval-buffer) |
165 (format ";;; This file is generated automatically by mu-cite %s.\n\n" | 163 (eval-current-buffer)) |
166 mu-cite/version)) | 164 (kill-buffer buffer)) |
167 (insert (format "(setq %s\n '(" mu-cite/registration-symbol)) | 165 ))) |
168 (insert (mapconcat | 166 (add-hook 'mu-cite-load-hook (function mu-cite/load-registration-file)) |
169 (function prin1-to-string) | 167 |
170 mu-cite/citation-name-alist "\n ")) | 168 (defun mu-cite/save-registration-file () |
171 (insert "\n ))\n\n") | 169 (let* ((file mu-cite/registration-file) |
172 (insert | 170 (buffer (get-buffer-create " *mu-register*"))) |
173 (format ";;; %s ends here.\n" (file-name-nondirectory filename))) | 171 (unwind-protect |
174 (save-buffer)) | 172 (save-excursion |
175 (kill-buffer buffer))) | 173 (set-buffer buffer) |
174 (setq buffer-file-name file) | |
175 (erase-buffer) | |
176 (insert ";;; " (file-name-nondirectory file) "\n") | |
177 (insert ";;; This file is generated automatically by mu-cite " | |
178 mu-cite/version "\n\n") | |
179 (insert "(setq " | |
180 (symbol-name mu-cite/registration-symbol) | |
181 "\n '(") | |
182 (insert (mapconcat | |
183 (function prin1-to-string) | |
184 mu-cite/citation-name-alist "\n ")) | |
185 (insert "\n ))\n\n") | |
186 (insert ";;; " | |
187 (file-name-nondirectory file) | |
188 " ends here.\n") | |
189 (save-buffer)) | |
190 (kill-buffer buffer)))) | |
176 | 191 |
177 | 192 |
178 ;;; @ item methods | 193 ;;; @ item methods |
179 ;;; | 194 ;;; |
180 | 195 |