;;; ==================================================================== ;;; @Emacs-Lisp-file{ ;;; author = "Nelson H. F. Beebe", ;;; version = "0.02", ;;; date = "18 October 1995", ;;; time = "21:48:31 MDT", ;;; filename = "journal-editor.el", ;;; address = "Center for Scientific Computing ;;; Department of Mathematics ;;; University of Utah ;;; Salt Lake City, UT 84112 ;;; USA", ;;; telephone = "+1 801 581 5254", ;;; FAX = "+1 801 581 4148", ;;; checksum = "20750 273 1041 9997", ;;; email = "beebe@math.utah.edu (Internet)", ;;; codetable = "ISO/ASCII", ;;; keywords = "BibTeX", ;;; supported = "yes", ;;; docstring = "This GNU Emacs file defines a ;;; journal-editor-mode to support editing files ;;; that track the journal publication editing ;;; process. The data format is identical to ;;; that used by BibTeX entries, in order that ;;; familiar editing actions and BibTeX software ;;; tools can be applied. ;;; ;;; The checksum field above contains a CRC-16 ;;; checksum as the first value, followed by the ;;; equivalent of the standard UNIX wc (word ;;; count) utility output of lines, words, and ;;; characters. This is produced by Robert ;;; Solovay's checksum utility.", ;;; } ;;; ==================================================================== ;;; journal-editor.el --- GNU Emacs editing support for journal editors ;; Author: Nelson H. F. Beebe ;; Created: 30-Mar-1995 ;; Version: 0.00 ;; Keywords: BibTeX ;; Copyright (C) 1995 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. ;; 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. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; 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, 675 Mass Ave, Cambridge, MA 02139, USA. ;;; Commentary: ;;; Change log: ;;; 0.02 [18-Oct-1995] Move (define-key ...) code into new function ;;; internal-journal-editor-define-keymaps so as ;;; to avoid altering any existing bibtex-mode ;;; windows. ;;; ;;; Add binding of .jem file extension to ;;; journal-editor-mode (also, put in ;;; usr/local/share/emacs/site-lisp/default.el, ;;; together with autoload invocation). ;;; ;;; Add (provide 'journal-editor) and -URL fields. ;;; ;;; Extend documentation of journal-editor-mode. ;;; ;;; 0.01 [31-Mar-1995] Add several new field types, and code to supply ;;; default values for them. ;;; ;;; 0.00 [30-Mar-1995] Original version. (provide 'journal-editor) ;to avoid unnecessary duplicate loads (require 'bibtex) ; Most of journal-editor-mode is built from (require 'bibtools) ; simple modifications of bibtex-mode and ; bibtools functions ;;; Associate .jem files with journal-editor-mode (if (not (assoc "\\.jem$" auto-mode-alist)) (setq auto-mode-alist (cons (cons "\\.jem$" 'journal-editor-mode) auto-mode-alist))) (defconst journal-editor-version "0.02 [18-Oct-1995]" "Version number of the journal-editor.el library, a collection of functions for supporting the editing of BibTeX-style files for tracking the journal editing process.") (defvar journal-name nil "*Name of the current journal in journal-editor-mode.") (defun extended-bibtex-find-text (arg) "Go to end of text of current field; with arg, go to beginning. However, if point is already at the end of the field, go to the next one." (interactive "P") (if (looking-at "\",$\\|,$") (forward-line 1)) (bibtex-find-text arg)) (defun internal-journal-editor-define-keymaps () "Create and initialize journal-editor-mode keymap and menu." ;;---------------------------------------------------------------------- ;; Create a keymap that starts out as a copy of the bibtex-mode-map (defvar journal-editor-mode-map (make-sparse-keymap)) (setq journal-editor-mode-map bibtex-mode-map) ;;---------------------------------------------------------------------- ;; Create a short menu of entry types for this mode (define-key journal-editor-mode-map [menu-bar entry-types] (cons "Entry-Types" (make-sparse-keymap "Entry-Types"))) (define-key journal-editor-mode-map [menu-bar entry-types journal-entry] '(" journal entry" . internal-journal-entry)) (define-key journal-editor-mode-map [menu-bar entry-types bibtex-Periodical] nil) ; override an entry created by my ; personal bibtex-mode ; extensions ;; Make the entry types available via key bindings (define-key journal-editor-mode-map "\C-c\C-ej" 'internal-journal-entry) ;;---------------------------------------------------------------------- ;; Create a short menu of editing actions for this mode (define-key journal-editor-mode-map [menu-bar move/edit] (cons "Journal-Edit" (make-sparse-keymap "Journal-Edit"))) (define-key journal-editor-mode-map [menu-bar move/edit internal-journal-editor-reset-date] '("reset date" . internal-journal-editor-reset-date)) (define-key journal-editor-mode-map [menu-bar move/edit bibtex-insert-standard-BibNet-citation-label] '("make label" . bibtex-insert-standard-BibNet-citation-label))) (defun internal-journal-editor-initialize () (setq bibtex-entry-field-alist '( ("JournalEntry" . ((( "author" "author-address" "author-email" "author-telephone" "author-FAX" "author-URL" "title" "date-accepted" "date-received" "date-returned" "date-to-referee-1" "date-from-referee-1" "date-to-referee-2" "date-from-referee-2" "disposition" "journal" "referee-1" "referee-1-address" "referee-1-email" "referee-1-telephone" "referee-1-FAX" "referee-1-URL" "referee-2" "referee-2-address" "referee-2-email" "referee-2-telephone" "referee-2-FAX" "referee-2-URL" "year")))))) (setq bibtex-text-alignment (length " = referee-1-telephone")) ;length of longest key (setq journal-name "") (setq indent-tabs-mode nil) ;tabs interfere with pattern matching (setq bibtex-include-OPTcrossref nil) (setq bibtex-include-OPTkey nil) (setq bibtex-include-OPTannote nil) (setq bibtex-acknowledgement-value "") (local-set-key "\"" 'self-insert-command) (local-set-key "\C-c\C-ej" 'internal-journal-entry) (local-set-key "\C-cr" 'internal-journal-editor-reset-date) (local-set-key "\C-cl" 'bibtex-insert-standard-BibNet-citation-label) (local-set-key "\C-i" 'extended-bibtex-find-text)) (defun internal-journal-editor-reset-date () "Find the next date-xxx key/value pair in the current entry and reset it to the current date." (interactive) (re-search-forward "^}\\|date-[a-z]+ *= *\"") (if (string-equal (buffer-substring (match-beginning 0) (match-end 0)) "}") t (kill-line) ;; current-time-string returns: ;; .123456789.123456789.123 ;; "Wed Oct 14 22:21:05 1987" ;; "Thu Mar 30 21:54:00 1995" (let ((now (current-time-string))) (insert (substring now 8 10) ; day number "-" (substring now 4 7) ; month abbrev "-" (substring now 20 24) ; year "\",")) (forward-line 1))) (defun internal-journal-entry () (interactive) (bibtex-entry "JournalEntry") ;; Try to get the journal name for the first existing entry which ;; has one supplied (save-excursion (goto-char (point-min)) (if (re-search-forward "^ *journal *= *\"[^\"]" nil t) (setq journal-name (buffer-substring (1- (point)) (search-forward "\""))))) ;; Supply the default journal name (save-excursion (re-search-forward "^ *journal *= *\"") (insert journal-name)) ;; Delete any acknowledgement line (let ((end)) (save-excursion (save-excursion (search-forward "\n}") (setq end (point))) (if (re-search-forward "^ *acknowledgement *=" end t) (progn (beginning-of-line) (kill-line 1))))) ;; Supply the current year (save-excursion (re-search-forward "^ *year *= *\"") (insert (substring (current-time-string) 20 24))) ;; Supply today as the date-received (save-excursion (re-search-forward "^ *date-received *= *\"") (beginning-of-line) (internal-journal-editor-reset-date))) (defun journal-editor-mode () "Major mode for editing journal-editor files. These files are intended to support the journal editing process. They resemble BibTeX files, but contain fields that are suited to tracking of the progress of the editorial process for receipt, review, rejection, or acceptance and publication, of manuscripts submitted to scientific journals." (interactive) ;;; (setq journal-editor-mode-map nil) (bibtex-mode) (internal-journal-editor-define-keymaps) (use-local-map journal-editor-mode-map) (setq major-mode 'journal-editor-mode) (setq mode-name "Journal-Editor") (internal-journal-editor-initialize) (run-hooks 'journal-editor-mode-hook))