;;; refbib.el --- convert refer-style references to ones usable by Latex bib
-;; Copyright (C) 1989, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 2001, 2002, 2003, 2004, 2005,
+;; 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
;; Author: Henry Kautz <kautz@research.att.com>
;; Maintainer: FSF
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
(defun r2b-capitalize-title (s)
"Like `capitalize', but don't capitalize stop words, except the first."
- (save-excursion
- (set-buffer (get-buffer-create "$$$Scratch$$$"))
- (erase-buffer)
- (insert s)
- (r2b-capitalize-title-region (point-min) (point-max))
- (buffer-string)))
+ (with-current-buffer (get-buffer-create "$$$Scratch$$$")
+ (erase-buffer)
+ (insert s)
+ (r2b-capitalize-title-region (point-min) (point-max))
+ (buffer-string)))
;*********************************************************
(defun r2b-reset ()
(defvar r2b-error-found nil)
-(eval-when-compile
- (defvar r2b-variables) (defvar r2bv-address) (defvar r2bv-annote)
- (defvar r2bv-author) (defvar r2bv-booktitle) (defvar r2bv-date)
- (defvar r2bv-decade) (defvar r2bv-editor) (defvar r2bv-entry-kind)
- (defvar r2bv-institution) (defvar r2bv-journal) (defvar r2bv-keywords)
- (defvar r2bv-kn) (defvar r2bv-month) (defvar r2bv-note)
- (defvar r2bv-number) (defvar r2bv-ordering) (defvar r2bv-organization)
- (defvar r2bv-pages) (defvar r2bv-primary-author) (defvar r2bv-publisher)
- (defvar r2bv-school) (defvar r2bv-title) (defvar r2bv-title-first-word)
- (defvar r2bv-tr) (defvar r2bv-type) (defvar r2bv-volume)
- (defvar r2bv-where) (defvar r2bv-year))
+(defvar r2b-variables) (defvar r2bv-address) (defvar r2bv-annote)
+(defvar r2bv-author) (defvar r2bv-booktitle) (defvar r2bv-date)
+(defvar r2bv-decade) (defvar r2bv-editor) (defvar r2bv-entry-kind)
+(defvar r2bv-institution) (defvar r2bv-journal) (defvar r2bv-keywords)
+(defvar r2bv-kn) (defvar r2bv-month) (defvar r2bv-note)
+(defvar r2bv-number) (defvar r2bv-ordering) (defvar r2bv-organization)
+(defvar r2bv-pages) (defvar r2bv-primary-author) (defvar r2bv-publisher)
+(defvar r2bv-school) (defvar r2bv-title) (defvar r2bv-title-first-word)
+(defvar r2bv-tr) (defvar r2bv-type) (defvar r2bv-volume)
+(defvar r2bv-where) (defvar r2bv-year)
(setq r2b-variables '(
r2b-error-found
(defun r2b-convert-buffer (output)
- "Transform current buffer and append to buffer OUTPUT.
+ "Transform current buffer and append to buffer OUTPUT.
Do `\\[r2b-help]' for more info."
- (interactive
- (list (read-string "Output to buffer: " r2b-out-buf-name)))
- (save-excursion
- (setq r2b-log (get-buffer-create r2b-log-name))
- (set-buffer r2b-log)
- (erase-buffer))
- (widen)
- (goto-char (point-min))
- (message "Working, please be patient...")
- (sit-for 0)
- (while (r2b-convert-record output) t)
- (message "Done, results in %s, errors in %s"
- r2b-out-buf-name r2b-log-name)
- )
+ (interactive
+ (list (read-string "Output to buffer: " r2b-out-buf-name)))
+ (with-current-buffer (setq r2b-log (get-buffer-create r2b-log-name))
+ (erase-buffer))
+ (widen)
+ (goto-char (point-min))
+ (message "Working, please be patient...")
+ (sit-for 0)
+ (while (r2b-convert-record output) t)
+ (message "Done, results in %s, errors in %s"
+ r2b-out-buf-name r2b-log-name))
(defvar r2b-help-message
" Refer to Bibtex Bibliography Conversion
(defun r2b-help ()
- "Print help describing the `refbib' package."
- (interactive)
- (with-output-to-temp-buffer "*Help*"
- (princ r2b-help-message)
- (save-excursion
- (set-buffer standard-output)
- (help-mode))))
+ "Print help describing the `refbib' package."
+ (interactive)
+ (with-output-to-temp-buffer "*Help*"
+ (princ r2b-help-message)
+ (with-current-buffer standard-output
+ (help-mode))))
(provide 'refbib)
(provide 'refer-to-bibtex)
-;;; arch-tag: 664afee2-6e76-4408-ba56-981d8a179586
+;; arch-tag: 664afee2-6e76-4408-ba56-981d8a179586
;;; refbib.el ends here