diff options
| author | Eric S. Raymond | 1993-04-28 21:19:21 +0000 |
|---|---|---|
| committer | Eric S. Raymond | 1993-04-28 21:19:21 +0000 |
| commit | 9ae11a8907ed33a01a64856549dabac48d19ff64 (patch) | |
| tree | 9f2c86089ac074abc990456bea65b34702420df3 | |
| parent | 8b38db33899654d1923284bee44985a058f790c0 (diff) | |
| download | emacs-9ae11a8907ed33a01a64856549dabac48d19ff64.tar.gz emacs-9ae11a8907ed33a01a64856549dabac48d19ff64.zip | |
Installed Aaron Larson's new bibtex.el. See the header comment for
details.
| -rw-r--r-- | lisp/textmodes/bibtex.el | 774 |
1 files changed, 545 insertions, 229 deletions
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index b441eaa9fbd..0b49065ea37 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el | |||
| @@ -6,7 +6,9 @@ | |||
| 6 | ;; Mark Shapiro <shapiro@corto.inria.fr> | 6 | ;; Mark Shapiro <shapiro@corto.inria.fr> |
| 7 | ;; Mike Newton <newton@gumby.cs.caltech.edu> | 7 | ;; Mike Newton <newton@gumby.cs.caltech.edu> |
| 8 | ;; Aaron Larson <alarson@src.honeywell.com> | 8 | ;; Aaron Larson <alarson@src.honeywell.com> |
| 9 | ;; Maintainer: Mark Shapiro <shapiro@corto.inria.fr> | 9 | ;; Version: 1.3.1 |
| 10 | ;; Maintainer:Aaron Larson <alarson@src.honeywell.com> | ||
| 11 | ;; Adapted-By: ESR | ||
| 10 | ;; Keywords: tex, bib | 12 | ;; Keywords: tex, bib |
| 11 | 13 | ||
| 12 | ;; This file is part of GNU Emacs. | 14 | ;; This file is part of GNU Emacs. |
| @@ -25,15 +27,105 @@ | |||
| 25 | ;; along with GNU Emacs; see the file COPYING. If not, write to | 27 | ;; along with GNU Emacs; see the file COPYING. If not, write to |
| 26 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 28 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
| 27 | 29 | ||
| 30 | ;;; TODO distribute texinfo file. | ||
| 31 | |||
| 32 | ;;; LCD Archive Entry: | ||
| 33 | ;;; bibtex-mode|Bengt Martensson, Marc Shapiro, Aaron Larson| | ||
| 34 | ;;; alarson@src.honeywell.com| | ||
| 35 | ;;; Support for maintaining BibTeX format bibliography databases| | ||
| 36 | ;;; 93-03-29|version 1.3|~/modes/bibtex-mode.el.Z| | ||
| 37 | |||
| 28 | ;;; Commentary: | 38 | ;;; Commentary: |
| 29 | 39 | ||
| 30 | ;; A major mode for entering and editing BibTex files, validating | 40 | ;;; BUGS: |
| 31 | ;; them, canonicalizing them, and sorting them. Includes entry | 41 | ;;; 1. using regular expressions to match the entire bibtex entry dies |
| 32 | ;; commands tailored to many different formats (book, master's this, | 42 | ;;; on long bibtex entires (e.g. those containing abstracts) since |
| 33 | ;; journal article, etc). Has loads of options. | 43 | ;;; the length of regular expression matches is fairly limited. |
| 44 | ;;; 2. When inserting a string (with \C-C\C-E\s) hitting a TAB results | ||
| 45 | ;;; in the error message "Can't find enclosing Bibtex field" instead | ||
| 46 | ;;; of moving to the empty string. [reported by gernot@cs.unsw.oz.au] | ||
| 47 | ;;; 3. Function string-equalp should be in a library file, not in this | ||
| 48 | ;;; file. | ||
| 49 | |||
| 50 | ;;; (current keeper: alarson@src.honeywell.com | ||
| 51 | ;;; previous: shapiro@corto.inria.fr) | ||
| 34 | 52 | ||
| 35 | ;;; Change Log: | 53 | ;;; Change Log: |
| 36 | 54 | ||
| 55 | ;; Mon Mar 29 14:06:06 1993 Aaron Larson (alarson at gendibal) | ||
| 56 | ;; | ||
| 57 | ;; * bibtex.el: V1.3 released Mar 30, 1993 | ||
| 58 | ;; (bibtex-field-name): Fix to match definition if latex manual, | ||
| 59 | ;; specifically letters, digits, and punctuation other than comma. | ||
| 60 | ;; Underscore is retained for historical reasons. | ||
| 61 | ;; (bibtex-make-field): Fix to work around bug in Lucid prin1-to-string | ||
| 62 | ;; function as reported by Martin Sjolin <marsj@ida.liu.se>. | ||
| 63 | ;; (bibtex-entry): minor code cleanup. | ||
| 64 | ;; (bibtex-mode-map): Remove key binding (C-c n) for | ||
| 65 | ;; narrow-to-bibtex-entry, previous binding violated emacs policy of | ||
| 66 | ;; reserving C-c followed by a letter for user customization. | ||
| 67 | ;; revise modification history to better conform to FSF changelog | ||
| 68 | ;; standards. | ||
| 69 | ;; (bibtex-refile-entry): Removed. Would need disclaimer papers to | ||
| 70 | ;; incorporate it into official sources, and unable to contact author. | ||
| 71 | ;; Fix minor "syntax" errors in documentation strings and such found | ||
| 72 | ;; by new byte compiler. Funs bibtex-mode, bibtex-remove-double-quotes | ||
| 73 | ;; | ||
| 74 | ;; | ||
| 75 | ;; Fri Jan 15 14:06:06 1993 Aaron Larson (alarson at gendibal) | ||
| 76 | ;; | ||
| 77 | ;; * bibtex.el: V1.2 released Feb 15 1993 | ||
| 78 | ;; (find-bibtex-entry-location bibtex-make-field): Fixed placement of | ||
| 79 | ;; "interactive specification". [Bug report from | ||
| 80 | ;; mernst@theory.lcs.mit.edu] | ||
| 81 | ;; Fixed problem where bibtex-entry would fail if user typed entry | ||
| 82 | ;; name in wrong case. | ||
| 83 | ;; (bibtex-inside-field) Position the cursor _before_ the last comma | ||
| 84 | ;; on a line (the comma is not necessarily "inside" the field); this | ||
| 85 | ;; does not seem to break any existing code. ref sct@dcs.edinburgh.ac.uk | ||
| 86 | ;; (bibtex-enclosing-field, bibtex-enclosing-reference): leave | ||
| 87 | ;; point unmoved if no enclosing field/reference is found. As a | ||
| 88 | ;; result of changes (3) and (4) bibtex-next-field works properly, | ||
| 89 | ;; even when called from the entry key position. | ||
| 90 | ;; (bibtex-remove-OPT): realign the '=' after removing the 'opt'. | ||
| 91 | ;; (bibtex-clean-entry): always remove any trailing comma from the | ||
| 92 | ;; end of a bibtex entry (these commas get stripped automatically when | ||
| 93 | ;; optional fields are killed by bibtex-kill-optional-field, but can be | ||
| 94 | ;; left if optional fields are removed by other means). | ||
| 95 | ;; (bibtex-x-help) Replace tab with spaces in X menu as noted by | ||
| 96 | ;; khera@cs.duke.edu | ||
| 97 | ;; (bibtex-refile-entry): Added (from brannon@jove.cs.caltech.edu) | ||
| 98 | ;; (bibtex-sort-ignore-string-entries sort-bibtex-entries, | ||
| 99 | ;; map-bibtex-entries): Added variable as requested by | ||
| 100 | ;; gernot@cs.unsw.oz.au, required changes to funs. | ||
| 101 | ;; (bibtex-current-entry-label): Added at request of | ||
| 102 | ;; yasuro@maekawa.is.uec.ac.jp | ||
| 103 | ;; (bibtex-DEAthesis:) Deleted along with corresponding entry from | ||
| 104 | ;; bibtex-x-help per shapiro@corto.inria.fr | ||
| 105 | ;; Moved narrow-to-bibtex-entry from C-c C-n to C-c n (the previous | ||
| 106 | ;; binding was in conflict with the binding for bibtex-pop-next. | ||
| 107 | ;; bug report from [shapiro@corto.inria.fr] | ||
| 108 | ;; | ||
| 109 | |||
| 110 | ;;; | ||
| 111 | ;;; alarson@src.honeywell.com 92-Feb-13 | ||
| 112 | ;;; 1. Made bibtex-entry user callable, now prompts for entry type (e.g. | ||
| 113 | ;;; Article), with completion, and bound it to a key. This is now my | ||
| 114 | ;;; preferred way to add most entries. | ||
| 115 | ;;; 2. Made fields of a bibtex entry derived from the alist bibtex-entry- | ||
| 116 | ;;; field-alist. | ||
| 117 | ;;; 3. Fixed handling of escaped double quotes, e.g. "Schr{\"o}dinger". | ||
| 118 | ;;; 4. Fixed bug where unhiding bibtex entries moved point. | ||
| 119 | ;;; 5. Made "field name" specs permit (name . value) for defaulting. E.g. | ||
| 120 | ;;; (setq bibtex-mode-user-optional-fields '(("library" . "alarson"))) | ||
| 121 | ;;; will generate the field: | ||
| 122 | ;;; library = "alarson", | ||
| 123 | ;;; 6. Added binding for narrow-to-bibtex-entry | ||
| 124 | ;;; 7. Adding a bibtex entry now runs hook: bibtex-add-entry-hook | ||
| 125 | ;;; 8. Made bibtex-clean-entry fixup text alignment, and eliminated the | ||
| 126 | ;;; dependency on bibtex-enclosing-reference which has a problem with | ||
| 127 | ;;; long entries (e.g. those containing abstracts). | ||
| 128 | ;;; | ||
| 37 | ;;; alarson@src.honeywell.com 92-Jan-31 | 129 | ;;; alarson@src.honeywell.com 92-Jan-31 |
| 38 | ;;; Added support for: ispell, beginning/end of entry movement, a simple | 130 | ;;; Added support for: ispell, beginning/end of entry movement, a simple |
| 39 | ;;; outline like mode (hide the bodies of bibtex entries), support for | 131 | ;;; outline like mode (hide the bodies of bibtex entries), support for |
| @@ -129,35 +221,43 @@ | |||
| 129 | ;;; Bengt Martensson <bengt@mathematik.uni-Bremen.de> 87-06-28 | 221 | ;;; Bengt Martensson <bengt@mathematik.uni-Bremen.de> 87-06-28 |
| 130 | ;;; Original version | 222 | ;;; Original version |
| 131 | 223 | ||
| 224 | ;;; Code: | ||
| 225 | |||
| 132 | ;;; NOTE by Marc Shapiro, 14-dec-87: | 226 | ;;; NOTE by Marc Shapiro, 14-dec-87: |
| 133 | ;;; (bibtex-x-environment) binds an X menu for bibtex mode to x-button-c-right. | 227 | ;;; (bibtex-x-environment) binds an X menu for bibtex mode to x-button-c-right. |
| 134 | ;;; Trouble is, in Emacs 18.44 you can't have a mode-specific mouse binding, | 228 | ;;; Trouble is, in Emacs 18.44 you can't have a mode-specific mouse binding, |
| 135 | ;;; so it will remain active in all windows. Yuck! | 229 | ;;; so it will remain active in all windows. Yuck! |
| 136 | 230 | ||
| 137 | ;;; Code: | ||
| 138 | |||
| 139 | (provide 'bibtex) | 231 | (provide 'bibtex) |
| 140 | 232 | ||
| 141 | ;;; these guys typically don't have autoloads...[alarson:19920131.1548CST] | 233 | ;;; these guys typically don't have autoloads...[alarson:19920131.1548CST] |
| 234 | ;;; Check for fboundp first so that if user autoloads them from non standard | ||
| 235 | ;;; places, the users bindings will take precedence. | ||
| 142 | (if (not (fboundp 'TeX-insert-quote)) | 236 | (if (not (fboundp 'TeX-insert-quote)) |
| 143 | (autoload 'TeX-insert-quote "tex-mode")) | 237 | (autoload 'TeX-insert-quote "tex-mode")) |
| 144 | (if (not (fboundp 'sort-subr)) | 238 | (if (not (fboundp 'sort-subr)) |
| 145 | (autoload 'sort-subr "sort")) | 239 | (autoload 'sort-subr "sort")) |
| 146 | 240 | ||
| 241 | ;;; These should be in a more generally accessible location. | ||
| 147 | 242 | ||
| 243 | (defun string-equalp (s1 s2) | ||
| 244 | "Like string= except differences in case are ignored." | ||
| 245 | (let ((ss1 (if (symbolp s1) (symbol-name s1) s1)) | ||
| 246 | (ss2 (if (symbolp s2) (symbol-name s2) s2))) | ||
| 247 | (and (= (length ss1) (length ss2)) | ||
| 248 | (string-equal (upcase ss1) (upcase ss2))))) | ||
| 249 | |||
| 250 | ;;; This should be moved into simple.el, and the functions there modified | ||
| 251 | ;;; to call it rather than doing it themselves. | ||
| 252 | (defun put-string-on-kill-ring (string) | ||
| 253 | "Make STRING be the first element of the kill ring." | ||
| 254 | (setq kill-ring (cons string kill-ring)) | ||
| 255 | (if (> (length kill-ring) kill-ring-max) | ||
| 256 | (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil)) | ||
| 257 | (setq kill-ring-yank-pointer kill-ring)) | ||
| 148 | 258 | ||
| 149 | (defvar bibtex-mode-syntax-table nil "") | ||
| 150 | (defvar bibtex-mode-abbrev-table nil "") | ||
| 151 | (define-abbrev-table 'bibtex-mode-abbrev-table ()) | ||
| 152 | (defvar bibtex-mode-map (make-sparse-keymap) "") | ||
| 153 | 259 | ||
| 154 | (defvar bibtex-pop-previous-search-point nil | ||
| 155 | "Next point where bibtex-pop-previous should start looking for a similar | ||
| 156 | entry.") | ||
| 157 | 260 | ||
| 158 | (defvar bibtex-pop-next-search-point nil | ||
| 159 | "Next point where bibtex-pop-next should start looking for a similar | ||
| 160 | entry.") | ||
| 161 | 261 | ||
| 162 | (defvar bibtex-clean-entry-zap-empty-opts t | 262 | (defvar bibtex-clean-entry-zap-empty-opts t |
| 163 | "*If non-nil, bibtex-clean-entry will delete all empty optional fields.") | 263 | "*If non-nil, bibtex-clean-entry will delete all empty optional fields.") |
| @@ -174,7 +274,148 @@ entry.") | |||
| 174 | 274 | ||
| 175 | (defvar bibtex-mode-user-optional-fields nil ;no default value | 275 | (defvar bibtex-mode-user-optional-fields nil ;no default value |
| 176 | "*List of optional fields that user want to have as always present | 276 | "*List of optional fields that user want to have as always present |
| 177 | when making a bibtex entry. One possibility is for ``keywords''") | 277 | when making a bibtex entry. One possibility is for ``keywords''. |
| 278 | Entries can be either strings or conses, in which case the car should be | ||
| 279 | string and the cdr the value to be inserted.") | ||
| 280 | |||
| 281 | (defvar bibtex-mode-syntax-table | ||
| 282 | (let ((st (make-syntax-table))) | ||
| 283 | ;; [alarson:19920214.1004CST] make double quote a string quote | ||
| 284 | (modify-syntax-entry ?\" "\"" st) | ||
| 285 | (modify-syntax-entry ?$ "$$ " st) | ||
| 286 | (modify-syntax-entry ?% "< " st) | ||
| 287 | (modify-syntax-entry ?' "w " st) | ||
| 288 | (modify-syntax-entry ?@ "w " st) | ||
| 289 | (modify-syntax-entry ?\\ "\\" st) | ||
| 290 | (modify-syntax-entry ?\f "> " st) | ||
| 291 | (modify-syntax-entry ?\n "> " st) | ||
| 292 | (modify-syntax-entry ?~ " " st) | ||
| 293 | st)) | ||
| 294 | |||
| 295 | (defvar bibtex-mode-abbrev-table nil "") | ||
| 296 | (define-abbrev-table 'bibtex-mode-abbrev-table ()) | ||
| 297 | (defvar bibtex-mode-map | ||
| 298 | (let ((km (make-sparse-keymap))) | ||
| 299 | |||
| 300 | (define-key km "\t" 'bibtex-find-text) | ||
| 301 | (define-key km "\n" 'bibtex-next-field) | ||
| 302 | (define-key km "\C-c\"" 'bibtex-remove-double-quotes) | ||
| 303 | (define-key km "\C-c\C-c" 'bibtex-clean-entry) | ||
| 304 | (define-key km "\C-c?" 'describe-mode) | ||
| 305 | (define-key km "\C-c\C-p" 'bibtex-pop-previous) | ||
| 306 | (define-key km "\C-c\C-n" 'bibtex-pop-next) | ||
| 307 | (define-key km "\C-c\C-k" 'bibtex-kill-optional-field) | ||
| 308 | (define-key km "\C-c\C-d" 'bibtex-empty-field) | ||
| 309 | |||
| 310 | ;; [alarson:19920131.1543CST] | ||
| 311 | (define-key km "\"" 'TeX-insert-quote) | ||
| 312 | (define-key km "\C-c$" 'ispell-bibtex-entry) | ||
| 313 | (define-key km "\M-\C-a" 'beginning-of-bibtex-entry) | ||
| 314 | (define-key km "\M-\C-e" 'end-of-bibtex-entry) | ||
| 315 | (define-key km "\C-ce" 'bibtex-entry) | ||
| 316 | ; (define-key km "\C-cn" 'narrow-to-bibtex-entry) | ||
| 317 | |||
| 318 | (define-key km "\C-c\C-e\C-a" 'bibtex-Article) | ||
| 319 | (define-key km "\C-c\C-e\C-b" 'bibtex-Book) | ||
| 320 | ; (define-key km "\C-c\C-e\C-d" 'bibtex-DEAthesis) | ||
| 321 | (define-key km "\C-c\C-e\C-c" 'bibtex-InProceedings) | ||
| 322 | (define-key km "\C-c\C-e\C-i" 'bibtex-InBook) | ||
| 323 | (define-key km "\C-c\C-ei" 'bibtex-InCollection) | ||
| 324 | (define-key km "\C-c\C-eI" 'bibtex-InProceedings) | ||
| 325 | (define-key km "\C-c\C-e\C-m" 'bibtex-Manual) | ||
| 326 | (define-key km "\C-c\C-em" 'bibtex-MastersThesis) | ||
| 327 | (define-key km "\C-c\C-eM" 'bibtex-Misc) | ||
| 328 | (define-key km "\C-c\C-o" 'bibtex-remove-OPT) | ||
| 329 | (define-key km "\C-c\C-e\C-p" 'bibtex-PhdThesis) | ||
| 330 | (define-key km "\C-c\C-ep" 'bibtex-Proceedings) | ||
| 331 | (define-key km "\C-c\C-eP" 'bibtex-preamble) | ||
| 332 | (define-key km "\C-c\C-e\C-t" 'bibtex-TechReport) | ||
| 333 | (define-key km "\C-c\C-e\C-s" 'bibtex-string) | ||
| 334 | (define-key km "\C-c\C-e\C-u" 'bibtex-Unpublished) | ||
| 335 | km)) | ||
| 336 | |||
| 337 | (defvar bibtex-pop-previous-search-point nil | ||
| 338 | "Next point where bibtex-pop-previous should start looking for a similar | ||
| 339 | entry.") | ||
| 340 | |||
| 341 | (defvar bibtex-pop-next-search-point nil | ||
| 342 | "Next point where bibtex-pop-next should start looking for a similar | ||
| 343 | entry.") | ||
| 344 | |||
| 345 | (defvar bibtex-entry-field-alist | ||
| 346 | '( | ||
| 347 | ("Article" . ((("author" "title" "journal" "year") | ||
| 348 | ("volume" "number" "pages" "month" "note")) | ||
| 349 | (("author" "title") | ||
| 350 | ("journal" "year" "volume" "number" "pages" | ||
| 351 | "month" "note")))) | ||
| 352 | ("Book" . ((("author" "title" "publisher" "year") | ||
| 353 | ("editor" "volume" "number" "series" "address" | ||
| 354 | "edition" "month" "note")))) | ||
| 355 | ("Booklet" . ((("title") | ||
| 356 | ("author" "howpublished" "address" "month" "year" "note")))) | ||
| 357 | |||
| 358 | ;; France: Dipl\^{o}me d'Etudes Approfondies (similar to Master's) | ||
| 359 | ; ("DEAthesis" . ((("author" "title" "school" "year") | ||
| 360 | ; ("address" "month" "note")))) | ||
| 361 | |||
| 362 | ("InBook" . ((("author" "title" "chapter" "publisher" "year") | ||
| 363 | ("editor" "pages" "volume" "number" "series" "address" | ||
| 364 | "edition" "month" "type" "note")) | ||
| 365 | (("author" "title" "chapter") | ||
| 366 | ("publisher" "year" "editor" "pages" "volume" "number" | ||
| 367 | "series" "address" "edition" "month" "type" "note")))) | ||
| 368 | |||
| 369 | |||
| 370 | ("InCollection" . ((("author" "title" | ||
| 371 | "booktitle" "publisher" "year") | ||
| 372 | ("editor" "volume" "number" "series" "type" "chapter" | ||
| 373 | "pages" "address" "edition" "month" "note")) | ||
| 374 | (("author" "title") | ||
| 375 | ("booktitle" "publisher" "year" | ||
| 376 | "editor" "volume" "number" "series" "type" "chapter" | ||
| 377 | "pages" "address" "edition" "month" "note")))) | ||
| 378 | |||
| 379 | |||
| 380 | ("InProceedings" . ((("author" "title" "booktitle" "year") | ||
| 381 | ("editor" "volume" "number" "series" "pages" | ||
| 382 | "organization" "publisher" "address" "month" "note")) | ||
| 383 | (("author" "title") | ||
| 384 | ("editor" "volume" "number" "series" "pages" | ||
| 385 | "booktitle" "year" | ||
| 386 | "organization" "publisher" "address" "month" "note")))) | ||
| 387 | |||
| 388 | |||
| 389 | ("Manual" . ((("title") | ||
| 390 | ("author" "organization" "address" "edition" "year" | ||
| 391 | "month" "note")))) | ||
| 392 | |||
| 393 | ("MastersThesis" . ((("author" "title" "school" "year") | ||
| 394 | ("address" "month" "note" "type")))) | ||
| 395 | |||
| 396 | ("Misc" . ((() | ||
| 397 | ("author" "title" "howpublished" "year" "month" "note")))) | ||
| 398 | |||
| 399 | ("PhdThesis" . ((("author" "title" "school" "year") | ||
| 400 | ("address" "month" "type" "note")))) | ||
| 401 | |||
| 402 | ("Proceedings" . ((("title" "year") | ||
| 403 | ("editor" "volume" "number" "series" "publisher" | ||
| 404 | "organization" "address" "month" "note")))) | ||
| 405 | |||
| 406 | ("TechReport" . ((("author" "title" "institution" "year") | ||
| 407 | ("type" "number" "address" "month" "note")))) | ||
| 408 | |||
| 409 | ("Unpublished" . ((("author" "title" "note") | ||
| 410 | ("year" "month")))) | ||
| 411 | ) | ||
| 412 | |||
| 413 | "List of (entry-name (required optional) (crossref-required crossref-optional)) | ||
| 414 | tripples. If the third element is nil, then the first pair can be used. Required | ||
| 415 | and optional are lists of strings. All entry creation functions use this variable | ||
| 416 | to generate entries, and bibtex-entry ensures the entry type is valid. This | ||
| 417 | variable can be used for example to make bibtex manipulate a different set of entry | ||
| 418 | types, e.g. a crossreference document of organization types.") | ||
| 178 | 419 | ||
| 179 | 420 | ||
| 180 | ;;; A bibtex file is a sequence of entries, either string definitions | 421 | ;;; A bibtex file is a sequence of entries, either string definitions |
| @@ -198,7 +439,24 @@ when making a bibtex entry. One possibility is for ``keywords''") | |||
| 198 | (defconst bibtex-text-in-cfield 2 | 439 | (defconst bibtex-text-in-cfield 2 |
| 199 | "The regexp subexpression number of the text part in bibtex-cfield.") | 440 | "The regexp subexpression number of the text part in bibtex-cfield.") |
| 200 | 441 | ||
| 201 | (defconst bibtex-field-name "[A-Za-z][---A-Za-z0-9:_+]*" | 442 | ;;; KAWATA Yasuro <yasuro@qqqq.maekawa.is.uec.ac.jp> reported bug that "/" |
| 443 | ;;; was not premitted in field names. The old value of this var was: | ||
| 444 | ;;; "[A-Za-z][---A-Za-z0-9:_+]*" | ||
| 445 | ;;; According to the LaTeX manual, page 71, the legal values are letters, | ||
| 446 | ;;; digits, and punctuation other than comma. Section 2.1 defines | ||
| 447 | ;;; punctuation as: | ||
| 448 | ;;; .:;,?!`'()[]-/*@ | ||
| 449 | ;;; and says that += can be used in normal text. Specifically #$%&~_^\{} | ||
| 450 | ;;; are called out as special chars. Some experimentation with LaTeX | ||
| 451 | ;;; indicates that # and ~ definitely don't work, but that the following | ||
| 452 | ;;; citation does! \cite{a0.:;?!`'()[]-/*@_&$^+=|<>}. I chose here to | ||
| 453 | ;;; permit _ since it was previously allowed, but otherwise to only handle | ||
| 454 | ;;; punc and += | ||
| 455 | ;;; Amendment: I couldn't get a regexp with both "[]"'s and hyphen to | ||
| 456 | ;;; work. It looks like you need them both to be the first entries in a | ||
| 457 | ;;; regexp pattern. [alarson:19930315.0900CST] | ||
| 458 | |||
| 459 | (defconst bibtex-field-name "[A-Za-z][---A-Za-z0-9.:;?!`'()/*@_+=]*" | ||
| 202 | "Regexp defining the name part of a bibtex field.") | 460 | "Regexp defining the name part of a bibtex field.") |
| 203 | 461 | ||
| 204 | ;; bibtex-field-text must be able to handle | 462 | ;; bibtex-field-text must be able to handle |
| @@ -294,6 +552,33 @@ Chosen on aesthetic grounds only.") | |||
| 294 | "Alignment for the text part in BibTeX fields. | 552 | "Alignment for the text part in BibTeX fields. |
| 295 | Equal to the space needed for the longest name part.") | 553 | Equal to the space needed for the longest name part.") |
| 296 | 554 | ||
| 555 | (defun bibtex-current-entry-label (&optional include-cite kill) | ||
| 556 | "Return the label of the bibtex entry containing, or preceeding point. | ||
| 557 | Optional argument INCLUDE-CITE, if true means put a '\\cite{}' around the | ||
| 558 | returned value. Second optional argument KILL, if true, means place the | ||
| 559 | returned value in the kill buffer. Interactively; providing prefix | ||
| 560 | argument makes INCLUDE-CITE true, and kill is true by default. | ||
| 561 | |||
| 562 | Rationale: | ||
| 563 | The intention is that someone will write a function that can be bound to | ||
| 564 | a mouse key so that people entering TeX can just mouse on the bibtex entry | ||
| 565 | and have the citation key inserted at the current point (which will almost | ||
| 566 | certainly be in some other bufer). In the interim this function is | ||
| 567 | marginally useful for keyboard binding and is not bound by default. | ||
| 568 | Suggested binding is ^C-k." | ||
| 569 | (interactive (list current-prefix-arg t)) | ||
| 570 | (save-excursion | ||
| 571 | (beginning-of-bibtex-entry) | ||
| 572 | (re-search-forward bibtex-reference-head (save-excursion (end-of-bibtex-entry) (point))) | ||
| 573 | (let* ((key (buffer-substring (match-beginning bibtex-key-in-head) | ||
| 574 | (match-end bibtex-key-in-head))) | ||
| 575 | (val (if include-cite | ||
| 576 | (format "\\cite{%s}" key) | ||
| 577 | key))) | ||
| 578 | (if kill | ||
| 579 | (put-string-on-kill-ring val)) | ||
| 580 | val))) | ||
| 581 | |||
| 297 | ;;; bibtex mode: | 582 | ;;; bibtex mode: |
| 298 | 583 | ||
| 299 | (defun bibtex-mode () | 584 | (defun bibtex-mode () |
| @@ -323,6 +608,24 @@ mouse button. | |||
| 323 | \\[bibtex-sun-environment] binds a mode-specific Sun menu to right | 608 | \\[bibtex-sun-environment] binds a mode-specific Sun menu to right |
| 324 | mouse button. | 609 | mouse button. |
| 325 | 610 | ||
| 611 | The following may be of interest as well: | ||
| 612 | |||
| 613 | Functions: | ||
| 614 | find-bibtex-duplicates | ||
| 615 | find-bibtex-entry-location | ||
| 616 | hide-bibtex-entry-bodies | ||
| 617 | sort-bibtex-entries | ||
| 618 | validate-bibtex-buffer | ||
| 619 | |||
| 620 | Variables: | ||
| 621 | bibtex-clean-entry-zap-empty-opts | ||
| 622 | bibtex-entry-field-alist | ||
| 623 | bibtex-include-OPTannote | ||
| 624 | bibtex-include-OPTcrossref | ||
| 625 | bibtex-include-OPTkey | ||
| 626 | bibtex-maintain-sorted-entries | ||
| 627 | bibtex-mode-user-optional-fields | ||
| 628 | |||
| 326 | Fields: | 629 | Fields: |
| 327 | address | 630 | address |
| 328 | Publisher's address | 631 | Publisher's address |
| @@ -338,7 +641,7 @@ Fields: | |||
| 338 | crossref | 641 | crossref |
| 339 | The database key of the entry being cross referenced. | 642 | The database key of the entry being cross referenced. |
| 340 | edition | 643 | edition |
| 341 | Edition of a book (e.g., ""second"") | 644 | Edition of a book (e.g., \"second\") |
| 342 | editor | 645 | editor |
| 343 | Name(s) of editor(s), in BibTeX name format. | 646 | Name(s) of editor(s), in BibTeX name format. |
| 344 | If there is also an author field, then the editor field should be | 647 | If there is also an author field, then the editor field should be |
| @@ -371,8 +674,8 @@ Fields: | |||
| 371 | title | 674 | title |
| 372 | The title of the thing being referenced | 675 | The title of the thing being referenced |
| 373 | type | 676 | type |
| 374 | Type of a technical report (e.g., ""Research Note"") to be used | 677 | Type of a technical report (e.g., \"Research Note\") to be used |
| 375 | instead of the default ""Technical Report"" | 678 | instead of the default \"Technical Report\" |
| 376 | volume | 679 | volume |
| 377 | Volume of a journal or multivolume work | 680 | Volume of a journal or multivolume work |
| 378 | year | 681 | year |
| @@ -382,63 +685,14 @@ Entry to this mode calls the value of bibtex-mode-hook if that value is | |||
| 382 | non-nil." | 685 | non-nil." |
| 383 | (interactive) | 686 | (interactive) |
| 384 | (kill-all-local-variables) | 687 | (kill-all-local-variables) |
| 385 | (if bibtex-mode-syntax-table | 688 | (set-syntax-table bibtex-mode-syntax-table) |
| 386 | (set-syntax-table bibtex-mode-syntax-table) | ||
| 387 | (setq bibtex-mode-syntax-table (make-syntax-table)) | ||
| 388 | (set-syntax-table bibtex-mode-syntax-table) | ||
| 389 | (modify-syntax-entry ?\" ".") | ||
| 390 | (modify-syntax-entry ?$ "$$ ") | ||
| 391 | (modify-syntax-entry ?% "< ") | ||
| 392 | (modify-syntax-entry ?' "w ") | ||
| 393 | (modify-syntax-entry ?@ "w ") | ||
| 394 | (modify-syntax-entry ?\\ "\\") | ||
| 395 | (modify-syntax-entry ?\f "> ") | ||
| 396 | (modify-syntax-entry ?\n "> ") | ||
| 397 | (modify-syntax-entry ?~ " ")) | ||
| 398 | (use-local-map bibtex-mode-map) | 689 | (use-local-map bibtex-mode-map) |
| 399 | (setq major-mode 'bibtex-mode) | 690 | (setq major-mode 'bibtex-mode) |
| 400 | |||
| 401 | |||
| 402 | (setq mode-name "BibTeX") | 691 | (setq mode-name "BibTeX") |
| 403 | (set-syntax-table bibtex-mode-syntax-table) | 692 | (set-syntax-table bibtex-mode-syntax-table) |
| 404 | (setq local-abbrev-table bibtex-mode-abbrev-table) | 693 | (setq local-abbrev-table bibtex-mode-abbrev-table) |
| 405 | (make-local-variable 'paragraph-start) | 694 | (make-local-variable 'paragraph-start) |
| 406 | (setq paragraph-start "^[ \f\n\t]*$") | 695 | (setq paragraph-start "^[ \f\n\t]*$") |
| 407 | |||
| 408 | (define-key bibtex-mode-map "\t" 'bibtex-find-text) | ||
| 409 | (define-key bibtex-mode-map "\n" 'bibtex-next-field) | ||
| 410 | (define-key bibtex-mode-map "\C-c\"" 'bibtex-remove-double-quotes) | ||
| 411 | (define-key bibtex-mode-map "\C-c\C-c" 'bibtex-clean-entry) | ||
| 412 | (define-key bibtex-mode-map "\C-c?" 'describe-mode) | ||
| 413 | (define-key bibtex-mode-map "\C-c\C-p" 'bibtex-pop-previous) | ||
| 414 | (define-key bibtex-mode-map "\C-c\C-n" 'bibtex-pop-next) | ||
| 415 | (define-key bibtex-mode-map "\C-c\C-k" 'bibtex-kill-optional-field) | ||
| 416 | (define-key bibtex-mode-map "\C-c\C-d" 'bibtex-empty-field) | ||
| 417 | |||
| 418 | ;; [alarson:19920131.1543CST] | ||
| 419 | (define-key bibtex-mode-map "\"" 'TeX-insert-quote) | ||
| 420 | (define-key bibtex-mode-map "\C-c$" 'ispell-bibtex-entry) | ||
| 421 | (define-key bibtex-mode-map "\M-\C-a" 'beginning-of-bibtex-entry) | ||
| 422 | (define-key bibtex-mode-map "\M-\C-e" 'end-of-bibtex-entry) | ||
| 423 | |||
| 424 | (define-key bibtex-mode-map "\C-c\C-e\C-a" 'bibtex-Article) | ||
| 425 | (define-key bibtex-mode-map "\C-c\C-e\C-b" 'bibtex-Book) | ||
| 426 | (define-key bibtex-mode-map "\C-c\C-e\C-d" 'bibtex-DEAthesis) | ||
| 427 | (define-key bibtex-mode-map "\C-c\C-e\C-c" 'bibtex-InProceedings) | ||
| 428 | (define-key bibtex-mode-map "\C-c\C-e\C-i" 'bibtex-InBook) | ||
| 429 | (define-key bibtex-mode-map "\C-c\C-ei" 'bibtex-InCollection) | ||
| 430 | (define-key bibtex-mode-map "\C-c\C-eI" 'bibtex-InProceedings) | ||
| 431 | (define-key bibtex-mode-map "\C-c\C-e\C-m" 'bibtex-Manual) | ||
| 432 | (define-key bibtex-mode-map "\C-c\C-em" 'bibtex-MastersThesis) | ||
| 433 | (define-key bibtex-mode-map "\C-c\C-eM" 'bibtex-Misc) | ||
| 434 | (define-key bibtex-mode-map "\C-c\C-o" 'bibtex-remove-OPT) | ||
| 435 | (define-key bibtex-mode-map "\C-c\C-e\C-p" 'bibtex-PhdThesis) | ||
| 436 | (define-key bibtex-mode-map "\C-c\C-ep" 'bibtex-Proceedings) | ||
| 437 | (define-key bibtex-mode-map "\C-c\C-eP" 'bibtex-preamble) | ||
| 438 | (define-key bibtex-mode-map "\C-c\C-e\C-t" 'bibtex-TechReport) | ||
| 439 | (define-key bibtex-mode-map "\C-c\C-e\C-s" 'bibtex-string) | ||
| 440 | (define-key bibtex-mode-map "\C-c\C-e\C-u" 'bibtex-Unpublished) | ||
| 441 | |||
| 442 | (auto-fill-mode 1) ; nice alignements | 696 | (auto-fill-mode 1) ; nice alignements |
| 443 | (setq left-margin (+ bibtex-text-alignment 1)) | 697 | (setq left-margin (+ bibtex-text-alignment 1)) |
| 444 | 698 | ||
| @@ -468,9 +722,49 @@ non-nil." | |||
| 468 | (interactive) | 722 | (interactive) |
| 469 | (re-search-backward "^@" nil 'move)) | 723 | (re-search-backward "^@" nil 'move)) |
| 470 | 724 | ||
| 725 | (defun skip-whitespace-and-comments () | ||
| 726 | ;; It might be a good idea to have forward-sexp with argument 0 do what | ||
| 727 | ;; this function tries to do, namely skip whitespace and comments. | ||
| 728 | ;; Maybe a better name for this would be skip-to-next-sexp. | ||
| 729 | ;; alternative implementation: | ||
| 730 | ;; (let ((parse-sexp-ignore-comments t)) | ||
| 731 | ;; (forward-sexp 1) | ||
| 732 | ;; (forward-sexp -1)) | ||
| 733 | ;; but I've had problems with this not getting the parse of comments | ||
| 734 | ;; right going backward if they contain unbalanced expressions or string | ||
| 735 | ;; quotes. [alarson:19920217.1021CST] | ||
| 736 | (let ((md (match-data))) | ||
| 737 | (unwind-protect | ||
| 738 | (while (cond ((looking-at "\\s>+\\|\\s +") | ||
| 739 | ;; was whitespace | ||
| 740 | ;; NOTE: also checked end-comment. In latex and | ||
| 741 | ;; lisp modes, newline is an end comment, but it | ||
| 742 | ;; should also be a whitespace char. | ||
| 743 | (goto-char (match-end 0))) | ||
| 744 | ;; If looking at beginning of comment, skip to end. | ||
| 745 | ((looking-at "\\s<") | ||
| 746 | (re-search-forward "\\s>")))) | ||
| 747 | (store-match-data md)))) | ||
| 748 | |||
| 749 | ;;; [alarson:19920214.1007CST] | ||
| 471 | (defun end-of-bibtex-entry () | 750 | (defun end-of-bibtex-entry () |
| 751 | "If inside an entry, move to the end of it, otherwise move to the end | ||
| 752 | of the next entry." | ||
| 472 | (interactive) | 753 | (interactive) |
| 473 | (re-search-forward "}$" nil 'move)) | 754 | ;; if point was previously at the end of an entry, this puts us |
| 755 | ;; inside the next entry, otherwise we remain in the current one. | ||
| 756 | (progn | ||
| 757 | (skip-whitespace-and-comments) | ||
| 758 | ;;; (skip-chars-forward " \t\n") | ||
| 759 | (end-of-line)) | ||
| 760 | (beginning-of-bibtex-entry) | ||
| 761 | (let ((parse-sexp-ignore-comments t)) | ||
| 762 | (forward-sexp) ; skip entry type | ||
| 763 | (forward-sexp) ; skip entry body | ||
| 764 | )) | ||
| 765 | ;(defun end-of-bibtex-entry () | ||
| 766 | ; (interactive) | ||
| 767 | ; (re-search-forward "}$" nil 'move)) | ||
| 474 | 768 | ||
| 475 | (defun ispell-bibtex-entry () | 769 | (defun ispell-bibtex-entry () |
| 476 | (interactive) | 770 | (interactive) |
| @@ -498,21 +792,29 @@ non-nil." | |||
| 498 | "Hide all lines between first and last bibtex entries not beginning with @. | 792 | "Hide all lines between first and last bibtex entries not beginning with @. |
| 499 | With argument, show all text." | 793 | With argument, show all text." |
| 500 | (interactive "P") | 794 | (interactive "P") |
| 501 | (beginning-of-first-bibtex-entry) | 795 | (save-excursion |
| 502 | ;; subst-char-in-region modifies the buffer, despite what the | 796 | (beginning-of-first-bibtex-entry) |
| 503 | ;; documentation says... | 797 | ;; subst-char-in-region modifies the buffer, despite what the |
| 504 | (let ((modifiedp (buffer-modified-p)) | 798 | ;; documentation says... |
| 505 | (buffer-read-only nil)) | 799 | (let ((modifiedp (buffer-modified-p)) |
| 506 | (if arg | 800 | (buffer-read-only nil)) |
| 507 | (subst-char-in-region (point) (point-max) ?\r ?\n t) | 801 | (if arg |
| 802 | (subst-char-in-region (point) (point-max) ?\r ?\n t) | ||
| 508 | (while (save-excursion (re-search-forward "\n[^@]" (point-max) t)) | 803 | (while (save-excursion (re-search-forward "\n[^@]" (point-max) t)) |
| 509 | (save-excursion (replace-regexp "\n\\([^@]\\)" "\r\\1")))) | 804 | (save-excursion (replace-regexp "\n\\([^@]\\)" "\r\\1")))) |
| 510 | (setq selective-display (not arg)) | 805 | (setq selective-display (not arg)) |
| 511 | (set-buffer-modified-p modifiedp))) | 806 | (set-buffer-modified-p modifiedp)))) |
| 807 | |||
| 808 | (defvar bibtex-sort-ignore-string-entries nil | ||
| 809 | "*If true, bibtex @STRING entries are ignored when determining ordering | ||
| 810 | of the buffer (e.g. sorting, locating alphabetical position for new entries, | ||
| 811 | etc.)") | ||
| 512 | 812 | ||
| 513 | (defun sort-bibtex-entries () | 813 | (defun sort-bibtex-entries () |
| 514 | "Sort bibtex entries alphabetically by key. | 814 | "Sort bibtex entries alphabetically by key. |
| 515 | Text before the first bibtex entry, and following the last is not effected. | 815 | Text before the first bibtex entry, and following the last is not affected. |
| 816 | If bibtex-sort-ignore-string-entries is true, @string entries will be ignored. | ||
| 817 | |||
| 516 | Bugs: | 818 | Bugs: |
| 517 | 1. Text between the closing brace ending one bibtex entry, and the @ starting | 819 | 1. Text between the closing brace ending one bibtex entry, and the @ starting |
| 518 | the next, is considered part of the PRECEEDING entry. Perhaps it should be | 820 | the next, is considered part of the PRECEEDING entry. Perhaps it should be |
| @@ -530,27 +832,40 @@ Bugs: | |||
| 530 | ;; begining of record function | 832 | ;; begining of record function |
| 531 | 'forward-line | 833 | 'forward-line |
| 532 | ;; end of record function | 834 | ;; end of record function |
| 533 | (function (lambda () (and (re-search-forward "}[ \t]*\n[\n \t]*@" nil 'move) | 835 | (function (lambda () (and (re-search-forward "}\\s-*\n[\n \t]*@" nil 'move) |
| 534 | (forward-char -2)))) | 836 | (forward-char -2)))) |
| 535 | ;; start of key function | 837 | ;; start of key function |
| 536 | (function (lambda () (re-search-forward "{[ \t]*") nil)) | 838 | (if bibtex-sort-ignore-string-entries |
| 839 | (function (lambda () | ||
| 840 | (while (and (re-search-forward "^\\s-*\\([@a-zA-Z]*\\)\\s-*{\\s-*") | ||
| 841 | (string-equalp "@string" | ||
| 842 | (buffer-substring (match-beginning 1) | ||
| 843 | (match-end 1))))) | ||
| 844 | nil)) | ||
| 845 | (function (lambda () (re-search-forward "{\\s-*") nil))) | ||
| 537 | ;; end of key function | 846 | ;; end of key function |
| 538 | (function (lambda () (search-forward ","))) | 847 | (function (lambda () (search-forward ","))) |
| 539 | ))) | 848 | ))) |
| 540 | 849 | ||
| 541 | (defun map-bibtex-entries (fun) | 850 | (defun map-bibtex-entries (fun) |
| 542 | "Call FUN for each bibtex entry starting with the current, to the end of the file. | 851 | "Call FUN for each bibtex entry starting with the current, to the end of the file. |
| 543 | FUN is called with one argument, the key of the entry, and with point inside the entry." | 852 | FUN is called with one argument, the key of the entry, and with point inside the entry. |
| 853 | If bibtex-sort-ignore-string-entries is true, FUN will not be called for @string entries." | ||
| 544 | (beginning-of-bibtex-entry) | 854 | (beginning-of-bibtex-entry) |
| 545 | (while (re-search-forward "^@[^{]*{[ \t]*\\([^,]*\\)" nil t) | 855 | (while (re-search-forward "^@[^{]*{[ \t]*\\([^, ]*\\)" nil t) |
| 546 | (funcall fun (buffer-substring (match-beginning 1) (match-end 1))))) | 856 | (if (and bibtex-sort-ignore-string-entries |
| 857 | (string-equalp "@string{" | ||
| 858 | (buffer-substring (match-beginning 0) | ||
| 859 | (match-beginning 1)))) | ||
| 860 | nil ; ignore the @string entry. | ||
| 861 | (funcall fun (buffer-substring (match-beginning 1) (match-end 1)))))) | ||
| 547 | 862 | ||
| 548 | (defun find-bibtex-entry-location (entry-name) | 863 | (defun find-bibtex-entry-location (entry-name) |
| 549 | (interactive "sBibtex entry key: ") | ||
| 550 | "Searches from beginning of current buffer looking for place to put the | 864 | "Searches from beginning of current buffer looking for place to put the |
| 551 | bibtex entry named ENTRY-NAME. Buffer is assumed to be in sorted order, | 865 | bibtex entry named ENTRY-NAME. Buffer is assumed to be in sorted order, |
| 552 | without duplicates (see \\[sort-bibtex-entries]), if it is not, an error will | 866 | without duplicates (see \\[sort-bibtex-entries]), if it is not, an error will |
| 553 | be signalled." | 867 | be signalled." |
| 868 | (interactive "sBibtex entry key: ") | ||
| 554 | (let ((previous nil) | 869 | (let ((previous nil) |
| 555 | point) | 870 | point) |
| 556 | (beginning-of-first-bibtex-entry) | 871 | (beginning-of-first-bibtex-entry) |
| @@ -600,6 +915,7 @@ be signalled." | |||
| 600 | (goto-char point) | 915 | (goto-char point) |
| 601 | (while (search-forward "\"" nil t) | 916 | (while (search-forward "\"" nil t) |
| 602 | (or (looking-at "[,}][ \t]*$") | 917 | (or (looking-at "[,}][ \t]*$") |
| 918 | (char-equal (preceding-char) ?\") | ||
| 603 | ;; some versions put closing brace on separate line. | 919 | ;; some versions put closing brace on separate line. |
| 604 | (looking-at "[ \t]*\n}") | 920 | (looking-at "[ \t]*\n}") |
| 605 | (save-excursion | 921 | (save-excursion |
| @@ -628,43 +944,60 @@ Buffer is assumed to be sorted, see \\[sort-bibtex-entries]" | |||
| 628 | (message "No duplicates found!"))) | 944 | (message "No duplicates found!"))) |
| 629 | 945 | ||
| 630 | 946 | ||
| 947 | ;;; assoc doesn't ignore case, so we need an assoc that does... | ||
| 948 | (defun assoc-string-equalp (thing alist) | ||
| 949 | (or (assoc thing alist) | ||
| 950 | (while (and alist | ||
| 951 | (not (string-equalp thing (car (car alist))))) | ||
| 952 | (setq alist (cdr alist))) | ||
| 953 | (car alist))) | ||
| 954 | |||
| 631 | (defvar bibtex-maintain-sorted-entries nil | 955 | (defvar bibtex-maintain-sorted-entries nil |
| 632 | "*If true, bibtex-mode will attempt to maintain all bibtex entries in | 956 | "*If true, bibtex-mode will attempt to maintain all bibtex entries in |
| 633 | sorted order.") | 957 | sorted order. |
| 634 | 958 | ||
| 635 | ;; | 959 | Note that this is more a property of a file than a personal preference and |
| 636 | ;; note: this should really take lists of strings OR of lists. in the | 960 | as such should normally be set via a file local variable entry.") |
| 637 | ;; second case, one can use either list. (ie: | 961 | |
| 638 | ;; "name" (("crossref") ("journal" "year")) ) | 962 | (defun bibtex-entry (entry-type &optional required optional) |
| 639 | ;; | 963 | (interactive (let* ((completion-ignore-case t) |
| 640 | 964 | (e-t (completing-read "Entry Type: " bibtex-entry-field-alist | |
| 641 | (defun bibtex-entry (entry-type required optional) | 965 | nil t))) |
| 642 | (let (key) | 966 | (list e-t))) |
| 643 | (if bibtex-maintain-sorted-entries | 967 | (if (and (null required) (null optional)) |
| 644 | (progn | 968 | (let* ((e (assoc-string-equalp entry-type bibtex-entry-field-alist)) |
| 645 | (setq key (read-string (format "%s key: " entry-type))) | 969 | (r-n-o (elt e 1)) |
| 646 | (find-bibtex-entry-location key))) | 970 | (c-ref (elt e 2))) |
| 971 | (if (null e) | ||
| 972 | (error "Bibtex entry type %s not defined!")) | ||
| 973 | (if (and bibtex-include-OPTcrossref c-ref) | ||
| 974 | (setq required (elt c-ref 0) | ||
| 975 | optional (elt c-ref 1)) | ||
| 976 | (setq required (elt r-n-o 0) | ||
| 977 | optional (elt r-n-o 1))))) | ||
| 978 | (let ((key (if bibtex-maintain-sorted-entries | ||
| 979 | (read-string (format "%s key: " entry-type))))) | ||
| 980 | (if key | ||
| 981 | (find-bibtex-entry-location key)) | ||
| 647 | (bibtex-move-outside-of-entry) | 982 | (bibtex-move-outside-of-entry) |
| 648 | (insert "@" entry-type "{") | 983 | (insert "@" entry-type "{") |
| 649 | (mapcar 'bibtex-make-field required) | ||
| 650 | (if bibtex-include-OPTcrossref | ||
| 651 | (bibtex-make-optional-field "crossref")) | ||
| 652 | (if bibtex-include-OPTkey | ||
| 653 | (bibtex-make-optional-field "key")) | ||
| 654 | (mapcar 'bibtex-make-optional-field optional) | ||
| 655 | (if bibtex-mode-user-optional-fields ;MON... | ||
| 656 | (mapcar 'bibtex-make-optional-field | ||
| 657 | bibtex-mode-user-optional-fields)) | ||
| 658 | (if bibtex-include-OPTannote | ||
| 659 | (bibtex-make-optional-field "annote")) | ||
| 660 | (insert "\n}\n\n") | ||
| 661 | (forward-char -3) | ||
| 662 | (up-list -1) | ||
| 663 | (forward-char 1) | ||
| 664 | (if key | 984 | (if key |
| 665 | (progn | 985 | (insert key)) |
| 666 | (insert key) | 986 | (save-excursion |
| 667 | (bibtex-next-field t))))) | 987 | (mapcar 'bibtex-make-field required) |
| 988 | (if bibtex-include-OPTcrossref | ||
| 989 | (bibtex-make-optional-field "crossref")) | ||
| 990 | (if bibtex-include-OPTkey | ||
| 991 | (bibtex-make-optional-field "key")) | ||
| 992 | (mapcar 'bibtex-make-optional-field optional) | ||
| 993 | (mapcar 'bibtex-make-optional-field | ||
| 994 | bibtex-mode-user-optional-fields) | ||
| 995 | (if bibtex-include-OPTannote | ||
| 996 | (bibtex-make-optional-field "annote")) | ||
| 997 | (insert "\n}\n\n")) | ||
| 998 | (if key | ||
| 999 | (bibtex-next-field t)) | ||
| 1000 | (run-hooks 'bibtex-add-entry-hook))) | ||
| 668 | 1001 | ||
| 669 | ;; (defun bibtex-entry (entry-type required optional) | 1002 | ;; (defun bibtex-entry (entry-type required optional) |
| 670 | ;; (bibtex-move-outside-of-entry) | 1003 | ;; (bibtex-move-outside-of-entry) |
| @@ -686,125 +1019,88 @@ sorted order.") | |||
| 686 | ;; (forward-char 1)) | 1019 | ;; (forward-char 1)) |
| 687 | 1020 | ||
| 688 | 1021 | ||
| 689 | (defun bibtex-make-field (str) | 1022 | (defun bibtex-make-field (e-t) |
| 690 | (interactive "sBibTeX entry type: ") | 1023 | (interactive "sBibTeX entry type: ") |
| 691 | (insert ",\n") | 1024 | (let ((name (if (consp e-t) (car e-t) e-t)) |
| 692 | (indent-to-column bibtex-name-alignement) | 1025 | (value (if (consp e-t) (cdr e-t) ""))) |
| 693 | (insert str " = ") | 1026 | (insert ",\n") |
| 694 | (indent-to-column bibtex-text-alignment) | 1027 | (indent-to-column bibtex-name-alignement) |
| 695 | (insert "\"\"") | 1028 | (insert name " = ") |
| 696 | nil) | 1029 | (indent-to-column bibtex-text-alignment) |
| 697 | 1030 | ;; lucid emacs prin1-to-string breaks the undo chain. When they fix | |
| 698 | (defun bibtex-make-optional-field (str) | 1031 | ;; that, the hack can be removed. [alarson:19930316.0805CST] |
| 1032 | ; (insert (prin1-to-string value)) | ||
| 1033 | ;; begin hack | ||
| 1034 | (insert (format (if (stringp value) "\"%s\"" "%s") | ||
| 1035 | value)) | ||
| 1036 | ;; end hack | ||
| 1037 | nil)) | ||
| 1038 | |||
| 1039 | (defun bibtex-make-optional-field (e-t) | ||
| 699 | (interactive "sOptional BibTeX entry type: ") | 1040 | (interactive "sOptional BibTeX entry type: ") |
| 700 | (insert ",\n") | 1041 | (if (consp e-t) |
| 701 | (indent-to-column bibtex-name-alignement) | 1042 | (setq e-t (cons (concat "OPT" (car e-t)) (cdr e-t))) |
| 702 | (insert "OPT" str " = ") | 1043 | (setq e-t (concat "OPT" e-t))) |
| 703 | (indent-to-column bibtex-text-alignment) | 1044 | (bibtex-make-field e-t)) |
| 704 | (insert "\"\"") | ||
| 705 | nil) | ||
| 706 | 1045 | ||
| 707 | ;; What to do about crossref? if present, journal and year are | 1046 | ;; What to do about crossref? if present, journal and year are |
| 708 | ;; both optional. Due to this, i move all of them into optional. -- MON | 1047 | ;; both optional. Due to this, i move all of them into optional. -- MON |
| 709 | 1048 | ||
| 710 | (defun bibtex-Article () | 1049 | (defun bibtex-Article () |
| 711 | (interactive) | 1050 | (interactive) |
| 712 | (if bibtex-include-OPTcrossref | 1051 | (bibtex-entry "Article")) |
| 713 | (bibtex-entry "Article" '("author" "title") | ||
| 714 | '("journal" "year" "volume" "number" "pages" | ||
| 715 | "month" "note")) | ||
| 716 | (bibtex-entry "Article" '("author" "title" "journal" "year") | ||
| 717 | '("volume" "number" "pages" "month" "note")))) | ||
| 718 | |||
| 719 | 1052 | ||
| 720 | (defun bibtex-Book () | 1053 | (defun bibtex-Book () |
| 721 | (interactive) | 1054 | (interactive) |
| 722 | (bibtex-entry "Book" '("author" "title" "publisher" "year") | 1055 | (bibtex-entry "Book")) |
| 723 | '("editor" "volume" "number" "series" "address" | ||
| 724 | "edition" "month" "note"))) | ||
| 725 | 1056 | ||
| 726 | (defun bibtex-Booklet () | 1057 | (defun bibtex-Booklet () |
| 727 | (interactive) | 1058 | (interactive) |
| 728 | (bibtex-entry "Booklet" '("title") | 1059 | (bibtex-entry "Booklet")) |
| 729 | '("author" "howpublished" "address" "month" "year" "note"))) | ||
| 730 | 1060 | ||
| 731 | ;; France: Dipl\^{o}me d'Etudes Approfondies (similar to Master's) | 1061 | ;(defun bibtex-DEAthesis () |
| 732 | (defun bibtex-DEAthesis () | 1062 | ; (interactive) |
| 733 | (interactive) | 1063 | ; (bibtex-entry "DEAthesis")) |
| 734 | (bibtex-entry "DEAthesis" '("author" "title" "school" "year") | ||
| 735 | '("address" "month" "note"))) | ||
| 736 | 1064 | ||
| 737 | (defun bibtex-InBook () | 1065 | (defun bibtex-InBook () |
| 738 | (interactive) | 1066 | (interactive) |
| 739 | (if bibtex-include-OPTcrossref | 1067 | (bibtex-entry "InBook")) |
| 740 | (bibtex-entry "InBook" '("author" "title" "chapter") | ||
| 741 | '("publisher" "year" "editor" "pages" "volume" "number" | ||
| 742 | "series" "address" "edition" "month" "type" "note")) | ||
| 743 | (bibtex-entry "InBook" '("author" "title" "chapter" "publisher" "year") | ||
| 744 | '("editor" "pages" "volume" "number" "series" "address" | ||
| 745 | "edition" "month" "type" "note")))) | ||
| 746 | 1068 | ||
| 747 | (defun bibtex-InCollection () | 1069 | (defun bibtex-InCollection () |
| 748 | (interactive) | 1070 | (interactive) |
| 749 | (if bibtex-include-OPTcrossref | 1071 | (bibtex-entry "InCollection")) |
| 750 | (bibtex-entry "InCollection" '("author" "title") | ||
| 751 | '("booktitle" "publisher" "year" | ||
| 752 | "editor" "volume" "number" "series" "type" "chapter" | ||
| 753 | "pages" "address" "edition" "month" "note")) | ||
| 754 | (bibtex-entry "InCollection" '("author" "title" | ||
| 755 | "booktitle" "publisher" "year") | ||
| 756 | '("editor" "volume" "number" "series" "type" "chapter" | ||
| 757 | "pages" "address" "edition" "month" "note")))) | ||
| 758 | |||
| 759 | 1072 | ||
| 760 | (defun bibtex-InProceedings () | 1073 | (defun bibtex-InProceedings () |
| 761 | (interactive) | 1074 | (interactive) |
| 762 | (if bibtex-include-OPTcrossref | 1075 | (bibtex-entry "InProceedings")) |
| 763 | (bibtex-entry "InProceedings" '("author" "title") | ||
| 764 | '("editor" "volume" "number" "series" "pages" | ||
| 765 | "booktitle" "year" | ||
| 766 | "organization" "publisher" "address" "month" "note")) | ||
| 767 | (bibtex-entry "InProceedings" '("author" "title" "booktitle" "year") | ||
| 768 | '("editor" "volume" "number" "series" "pages" | ||
| 769 | "organization" "publisher" "address" "month" "note")))) | ||
| 770 | |||
| 771 | 1076 | ||
| 772 | (defun bibtex-Manual () | 1077 | (defun bibtex-Manual () |
| 773 | (interactive) | 1078 | (interactive) |
| 774 | (bibtex-entry "Manual" '("title") | 1079 | (bibtex-entry "Manual")) |
| 775 | '("author" "organization" "address" "edition" "year" | ||
| 776 | "month" "note"))) | ||
| 777 | 1080 | ||
| 778 | (defun bibtex-MastersThesis () | 1081 | (defun bibtex-MastersThesis () |
| 779 | (interactive) | 1082 | (interactive) |
| 780 | (bibtex-entry "MastersThesis" '("author" "title" "school" "year") | 1083 | (bibtex-entry "MastersThesis")) |
| 781 | '("address" "month" "note" "type"))) | ||
| 782 | 1084 | ||
| 783 | (defun bibtex-Misc () | 1085 | (defun bibtex-Misc () |
| 784 | (interactive) | 1086 | (interactive) |
| 785 | (bibtex-entry "Misc" '() | 1087 | (bibtex-entry "Misc")) |
| 786 | '("author" "title" "howpublished" "year" "month" "note"))) | ||
| 787 | 1088 | ||
| 788 | (defun bibtex-PhdThesis () | 1089 | (defun bibtex-PhdThesis () |
| 789 | (interactive) | 1090 | (interactive) |
| 790 | (bibtex-entry "PhdThesis" '("author" "title" "school" "year") | 1091 | (bibtex-entry "PhdThesis")) |
| 791 | '("address" "month" "type" "note"))) | ||
| 792 | 1092 | ||
| 793 | (defun bibtex-Proceedings () | 1093 | (defun bibtex-Proceedings () |
| 794 | (interactive) | 1094 | (interactive) |
| 795 | (bibtex-entry "Proceedings" '("title" "year") | 1095 | (bibtex-entry "Proceedings")) |
| 796 | '("editor" "volume" "number" "series" "publisher" | ||
| 797 | "organization" "address" "month" "note"))) | ||
| 798 | 1096 | ||
| 799 | (defun bibtex-TechReport () | 1097 | (defun bibtex-TechReport () |
| 800 | (interactive) | 1098 | (interactive) |
| 801 | (bibtex-entry "TechReport" '("author" "title" "institution" "year") | 1099 | (bibtex-entry "TechReport")) |
| 802 | '("type" "number" "address" "month" "note"))) | ||
| 803 | 1100 | ||
| 804 | (defun bibtex-Unpublished () | 1101 | (defun bibtex-Unpublished () |
| 805 | (interactive) | 1102 | (interactive) |
| 806 | (bibtex-entry "Unpublished" '("author" "title" "note") | 1103 | (bibtex-entry "Unpublished")) |
| 807 | '("year" "month"))) | ||
| 808 | 1104 | ||
| 809 | (defun bibtex-string () | 1105 | (defun bibtex-string () |
| 810 | (interactive) | 1106 | (interactive) |
| @@ -880,7 +1176,12 @@ sorted order.") | |||
| 880 | (save-excursion | 1176 | (save-excursion |
| 881 | (goto-char (match-beginning bibtex-name-in-field)) | 1177 | (goto-char (match-beginning bibtex-name-in-field)) |
| 882 | (if (looking-at "OPT") | 1178 | (if (looking-at "OPT") |
| 883 | (delete-char (length "OPT")))) | 1179 | ;; sct@dcs.edinburgh.ac.uk |
| 1180 | (progn | ||
| 1181 | (delete-char (length "OPT")) | ||
| 1182 | (search-forward "=") | ||
| 1183 | (delete-horizontal-space) | ||
| 1184 | (indent-to-column bibtex-text-alignment)))) | ||
| 884 | (bibtex-inside-field)) | 1185 | (bibtex-inside-field)) |
| 885 | 1186 | ||
| 886 | (defun bibtex-inside-field () | 1187 | (defun bibtex-inside-field () |
| @@ -889,12 +1190,12 @@ sorted order.") | |||
| 889 | (end-of-line) | 1190 | (end-of-line) |
| 890 | (skip-chars-backward " \t") ;MON - maybe delete these chars? | 1191 | (skip-chars-backward " \t") ;MON - maybe delete these chars? |
| 891 | (cond ((= (preceding-char) ?,) | 1192 | (cond ((= (preceding-char) ?,) |
| 892 | (forward-char -1))) | 1193 | (forward-char -2))) ; -1 --> -2 sct@dcs.edinburgh.ac.uk |
| 893 | (cond ((= (preceding-char) ?\") | 1194 | (cond ((= (preceding-char) ?\") |
| 894 | (forward-char -1)))) ;MON - only go back if quote | 1195 | (forward-char -1)))) ;MON - only go back if quote |
| 895 | 1196 | ||
| 896 | (defun bibtex-remove-double-quotes () | 1197 | (defun bibtex-remove-double-quotes () |
| 897 | "Removes """" around string." | 1198 | "Removes \"\" around string." |
| 898 | (interactive) | 1199 | (interactive) |
| 899 | (save-excursion | 1200 | (save-excursion |
| 900 | (bibtex-inside-field) | 1201 | (bibtex-inside-field) |
| @@ -1067,19 +1368,25 @@ intermixed with \\[bibtex-pop-previous] (bibtex-pop-previous)." | |||
| 1067 | "Search for BibTeX field enclosing point. | 1368 | "Search for BibTeX field enclosing point. |
| 1068 | Point moves to end of field; also, use match-beginning and match-end | 1369 | Point moves to end of field; also, use match-beginning and match-end |
| 1069 | to parse the field." | 1370 | to parse the field." |
| 1070 | (condition-case errname | 1371 | ;; sct@dcs.edinburgh.ac.uk |
| 1071 | (bibtex-enclosing-regexp bibtex-field) | 1372 | (let ((old-point (point))) |
| 1072 | (search-failed | 1373 | (condition-case errname |
| 1073 | (error "Can't find enclosing BibTeX field.")))) | 1374 | (bibtex-enclosing-regexp bibtex-field) |
| 1375 | (search-failed | ||
| 1376 | (goto-char old-point) | ||
| 1377 | (error "Can't find enclosing BibTeX field."))))) | ||
| 1074 | 1378 | ||
| 1075 | (defun bibtex-enclosing-reference () | 1379 | (defun bibtex-enclosing-reference () |
| 1076 | "Search for BibTeX reference enclosing point. | 1380 | "Search for BibTeX reference enclosing point. |
| 1077 | Point moves to end of reference; also, use match-beginning and match-end | 1381 | Point moves to end of reference; also, use match-beginning and match-end |
| 1078 | to parse the reference." | 1382 | to parse the reference." |
| 1079 | (condition-case errname | 1383 | ;; sct@dcs.edinburgh.ac.uk |
| 1080 | (bibtex-enclosing-regexp bibtex-reference) | 1384 | (let ((old-point (point))) |
| 1081 | (search-failed | 1385 | (condition-case errname |
| 1082 | (error "Can't find enclosing BibTeX reference.")))) | 1386 | (bibtex-enclosing-regexp bibtex-reference) |
| 1387 | (search-failed | ||
| 1388 | (goto-char old-point) | ||
| 1389 | (error "Can't find enclosing BibTeX reference."))))) | ||
| 1083 | 1390 | ||
| 1084 | (defun bibtex-enclosing-regexp (regexp) | 1391 | (defun bibtex-enclosing-regexp (regexp) |
| 1085 | "Search for REGEXP enclosing point. | 1392 | "Search for REGEXP enclosing point. |
| @@ -1115,11 +1422,10 @@ an undefined location. | |||
| 1115 | (defun bibtex-clean-entry () | 1422 | (defun bibtex-clean-entry () |
| 1116 | "For all optional fields of current BibTeX entry: if empty, kill the whole field; otherwise, remove the \"OPT\" string in the name; if text numerical, remove double-quotes. For all mandatory fields: if empty, signal error." | 1423 | "For all optional fields of current BibTeX entry: if empty, kill the whole field; otherwise, remove the \"OPT\" string in the name; if text numerical, remove double-quotes. For all mandatory fields: if empty, signal error." |
| 1117 | (interactive) | 1424 | (interactive) |
| 1118 | (bibtex-enclosing-reference) | 1425 | (beginning-of-bibtex-entry) |
| 1119 | (goto-char (match-beginning 0)) | ||
| 1120 | (let ((start (point))) | 1426 | (let ((start (point))) |
| 1121 | (save-restriction | 1427 | (save-restriction |
| 1122 | (narrow-to-region start (match-end 0)) | 1428 | (narrow-to-region start (save-excursion (end-of-bibtex-entry) (point))) |
| 1123 | (while (re-search-forward bibtex-field (point-max) t 1) | 1429 | (while (re-search-forward bibtex-field (point-max) t 1) |
| 1124 | (let ((begin-field (match-beginning 0)) | 1430 | (let ((begin-field (match-beginning 0)) |
| 1125 | (end-field (match-end 0)) | 1431 | (end-field (match-end 0)) |
| @@ -1138,6 +1444,11 @@ an undefined location. | |||
| 1138 | ; otherwise: not empty, delete "OPT" | 1444 | ; otherwise: not empty, delete "OPT" |
| 1139 | (goto-char begin-name) | 1445 | (goto-char begin-name) |
| 1140 | (delete-char (length "OPT")) | 1446 | (delete-char (length "OPT")) |
| 1447 | (progn | ||
| 1448 | ;; fixup alignment. [alarson:19920309.2047CST] | ||
| 1449 | (search-forward "=") | ||
| 1450 | (delete-horizontal-space) | ||
| 1451 | (indent-to-column bibtex-text-alignment)) | ||
| 1141 | (goto-char begin-field) ; and loop to go through next test | 1452 | (goto-char begin-field) ; and loop to go through next test |
| 1142 | )) | 1453 | )) |
| 1143 | (t | 1454 | (t |
| @@ -1165,10 +1476,14 @@ an undefined location. | |||
| 1165 | (t | 1476 | (t |
| 1166 | (goto-char end-field)))))))) | 1477 | (goto-char end-field)))))))) |
| 1167 | (goto-char start) | 1478 | (goto-char start) |
| 1168 | (skip-chars-forward "@a-zA-Z") | 1479 | (end-of-bibtex-entry) |
| 1169 | (bibtex-enclosing-reference) | 1480 | ;; sct@dcs.edinburgh.ac.uk |
| 1170 | (goto-char (match-end 0)) | 1481 | (save-excursion |
| 1171 | (skip-chars-forward " \t\n"))) | 1482 | (previous-line 1) |
| 1483 | (end-of-line) | ||
| 1484 | (if (eq (preceding-char) ?,) | ||
| 1485 | (backward-delete-char 1))) | ||
| 1486 | (skip-whitespace-and-comments))) | ||
| 1172 | 1487 | ||
| 1173 | 1488 | ||
| 1174 | 1489 | ||
| @@ -1176,7 +1491,7 @@ an undefined location. | |||
| 1176 | 1491 | ||
| 1177 | (defun bibtex-x-help (arg) | 1492 | (defun bibtex-x-help (arg) |
| 1178 | "Mouse commands for BibTeX mode" | 1493 | "Mouse commands for BibTeX mode" |
| 1179 | 1494 | ||
| 1180 | (let ((selection | 1495 | (let ((selection |
| 1181 | (x-popup-menu | 1496 | (x-popup-menu |
| 1182 | arg | 1497 | arg |
| @@ -1186,9 +1501,9 @@ an undefined location. | |||
| 1186 | (" Article in journal " . bibtex-Article) | 1501 | (" Article in journal " . bibtex-Article) |
| 1187 | (" Book " . bibtex-Book) | 1502 | (" Book " . bibtex-Book) |
| 1188 | (" Booklet " . bibtex-Booklet) | 1503 | (" Booklet " . bibtex-Booklet) |
| 1189 | (" Conference " . bibtex-InProceedings) | 1504 | (" Conference " . bibtex-InProceedings) |
| 1190 | (" Master's Thesis " . bibtex-MastersThesis) | 1505 | (" Master's Thesis " . bibtex-MastersThesis) |
| 1191 | (" DEA Thesis " . bibtex-DEAthesis) | 1506 | ; (" DEA Thesis " . bibtex-DEAthesis) |
| 1192 | (" Phd. Thesis " . bibtex-PhdThesis) | 1507 | (" Phd. Thesis " . bibtex-PhdThesis) |
| 1193 | (" Technical Report " . bibtex-TechReport) | 1508 | (" Technical Report " . bibtex-TechReport) |
| 1194 | (" technical Manual " . bibtex-Manual) | 1509 | (" technical Manual " . bibtex-Manual) |
| @@ -1228,9 +1543,9 @@ an undefined location. | |||
| 1228 | ;; since we aren't interested. See etc/SUN-SUPPORT for the reasons why | 1543 | ;; since we aren't interested. See etc/SUN-SUPPORT for the reasons why |
| 1229 | ;; we consider this nothing but a distraction from our work. | 1544 | ;; we consider this nothing but a distraction from our work. |
| 1230 | 1545 | ||
| 1231 | (defmacro eval-in-menu-window (&rest l) | 1546 | ;(defmacro eval-in-menu-window (&rest l) |
| 1232 | "Evaluates its argument in the window in which the mouse button was pressed." | 1547 | ; "Evaluates its argument in the window in which the mouse button was pressed." |
| 1233 | (list 'eval-in-window '*menu-window* l)) | 1548 | ; (list 'eval-in-window '*menu-window* l)) |
| 1234 | 1549 | ||
| 1235 | ;(defmenu bibtex-sun-entry-menu | 1550 | ;(defmenu bibtex-sun-entry-menu |
| 1236 | ; ("Article In Conf. Proc." eval-in-menu-window bibtex-InProceedings) | 1551 | ; ("Article In Conf. Proc." eval-in-menu-window bibtex-InProceedings) |
| @@ -1262,14 +1577,15 @@ an undefined location. | |||
| 1262 | ; ("describe BibTeX mode" eval-in-menu-window describe-mode) | 1577 | ; ("describe BibTeX mode" eval-in-menu-window describe-mode) |
| 1263 | ; ("Main Emacs menu" . emacs-menu)) | 1578 | ; ("Main Emacs menu" . emacs-menu)) |
| 1264 | 1579 | ||
| 1265 | (defun bibtex-sun-menu-eval (window x y) | 1580 | ;(defun bibtex-sun-menu-eval (window x y) |
| 1266 | "Pop-up menu of BibTeX commands." | 1581 | ; "Pop-up menu of BibTeX commands." |
| 1267 | (sun-menu-evaluate window (1+ x) (1- y) 'bibtex-sun-menu)) | 1582 | ; (sun-menu-evaluate window (1+ x) (1- y) 'bibtex-sun-menu)) |
| 1268 | 1583 | ; | |
| 1269 | (defun bibtex-sun-environment () | 1584 | ;(defun bibtex-sun-environment () |
| 1270 | "Set up sun menus for BibTeX mode. Call it as bibtex-mode-hook, or | 1585 | ; "Set up sun menus for BibTeX mode. Call it as bibtex-mode-hook, or |
| 1271 | interactively" | 1586 | ;interactively" |
| 1272 | (interactive) | 1587 | ; (interactive) |
| 1273 | (local-set-mouse '(text right) 'bibtex-sun-menu-eval)) | 1588 | ; (local-set-mouse '(text right) 'bibtex-sun-menu-eval)) |
| 1589 | ; | ||
| 1274 | 1590 | ||
| 1275 | ;;; bibtex-mode.el ends here | 1591 | ;;; bibtex.el ends here |