;ELC ;;; compiled by kwzh@hal.gnu.ai.mit.edu on Mon Apr 17 19:48:44 1995 ;;; from file /gd/gnu/emacs/19.0/lisp/refbib.el ;;; emacs version 19.28.90.26. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "`/gd/gnu/emacs/19.0/lisp/refbib.el' was compiled for Emacs 19")) #@19 *trace conversion (defvar r2b-trace-on nil (#$ . -481)) #@685 Abbreviation list for journal names. If the car of an element matches a journal name exactly, it is replaced by the cadr when output. Braces must be included if replacement is a {string}, but not if replacement is a bibtex abbreviation. The cadr may be eliminated if is exactly the same as the car. Because titles are capitalized before matching, the abbreviation for the journal name should be listed as beginning with a capital letter, even if it really doesn't. For example, a value of '(("Aij" "{Artificial Intelligence}") ("Ijcai81" "ijcai7")) would expand Aij to the text string "Artificial Intelligence", but would replace Ijcai81 with the BibTeX macro "ijcai7". (defvar r2b-journal-abbrevs nil (#$ . 544)) #@682 Abbreviation list for book and proceedings names. If the car of an element matches a title or booktitle exactly, it is replaced by the cadr when output. Braces must be included if replacement is a {string}, but not if replacement is a bibtex abbreviation. The cadr may be eliminated if is exactly the same as the car. Because titles are capitalized before matching, the abbreviated title should be listed as beginning with a capital letter, even if it doesn't. For example, a value of '(("Aij" "{Artificial Intelligence}") ("Ijcai81" "ijcai7")) would expand Aij to the text string "Artificial Intelligence", but would replace Ijcai81 with the BibTeX macro "ijcai7". (defvar r2b-booktitle-abbrevs nil (#$ . 1279)) #@856 Assoc list of books or journals which are really conference proceedings, but whose name and whose abbrev expansion (as defined in `r2b-journal-abbrevs' and `r2b-booktitle-abbrevs') does not contain the words "conference" or "proceedings". (Those cases are handled automatically.) The entry must match the given data exactly. Because titles are capitalized before matching, the items in this list should begin with a capital letter. For example, suppose the title "Ijcai81" is used for the proceedings of a conference, and it's expansion is the BibTeX macro "ijcai7". Then `r2b-proceedings-list' should be '(("Ijcai81") ...). If instead its expansion were "Proceedings of the Seventh International Conference on Artificial Intelligence", then you would NOT need to include Ijcai81 in `r2b-proceedings-list' (although it wouldn't cause an error). (defvar r2b-proceedings-list nil (#$ . 2014)) #@104 Words other than the `capitialize-title-stop-words' which are not to be used to build the citation key (defvar r2b-additional-stop-words "Some\\|What" (#$ . 2922)) #@62 *If true, then use " to delimit fields, otherwise use braces (defvar r2b-delimit-with-quote t (#$ . -3092)) #@87 Words not to be capitialized in a title (unless they are the first word in the title) (defvar capitalize-title-stop-words (concat "the\\|and\\|of\\|is\\|a\\|an\\|of\\|for\\|in\\|to\\|in\\|on\\|at\\|" "by\\|with\\|that\\|its") (#$ . 3206)) (byte-code "! Q B" [boundp capitalize-title-stop-regexp "\\(" capitalize-title-stop-words "\\)\\(\\b\\|'\\)" current-load-list] 3) #@78 Like `capitalize-region', but don't capitalize stop words, except the first. (defalias 'capitalize-title-region #[(begin end) " Ď!}eb!\"v&!#R!:v&!)K!&!&," [nil syntax-table orig-syntax-table case-fold-search ((set-syntax-table orig-syntax-table)) set-syntax-table text-mode-syntax-table begin end looking-at "[A-Z][a-z]*[A-Z]" 1 capitalize-word re-search-forward "\\<" t capitalize-title-stop-regexp downcase-word] 4 (#$ . 3594) "r"]) #@69 Like capitalize, but don't capitalize stop words, except the first. (defalias 'capitalize-title #[(s) "!q ced\" )" [get-buffer-create "$$$Scratch$$$" erase-buffer s capitalize-title-region buffer-string] 3 (#$ . 4094)]) #@32 Unbind defvars, for debugging. (defalias 'r2b-reset #[nil "!!!!!!!" [makunbound r2b-journal-abbrevs r2b-booktitle-abbrevs r2b-proceedings-list capitalize-title-stop-words capitalize-title-stop-regexp r2b-additional-stop-words r2b-stop-regexp] 2 (#$ . 4332) nil]) (byte-code "! ưB" [boundp r2b-stop-regexp "\\`\\(\\(" r2b-additional-stop-words "\\|" capitalize-title-stop-words "\\)\\('\\w*\\)?\\W+\\)*\\([A-Z0-9]+\\)" current-load-list] 5) (defalias 'r2b-trace #[(&rest args) "\f \"!" [r2b-trace-on apply message args sit-for 0] 3]) #@43 Returns string matched in current buffer. (defalias 'r2b-match #[(exp) "{" [exp] 2 (#$ . 4919)]) #@30 *output from refer-to-bibtex (defvar r2b-out-buf-name "*Out*" (#$ . -5027)) #@35 *logs errors from refer-to-bibtex (defvar r2b-log-name "*Log*" (#$ . -5109)) (byte-code "! B! B!  B!- B‡" [boundp r2b-in-buf nil current-load-list r2b-out-buf r2b-log r2b-error-found (r2b-error-found r2bv-author r2bv-primary-author r2bv-date r2bv-year r2bv-decade r2bv-month r2bv-title r2bv-title-first-word r2bv-editor r2bv-annote r2bv-tr r2bv-address r2bv-institution r2bv-keywords r2bv-booktitle r2bv-journal r2bv-volume r2bv-number r2bv-pages r2bv-booktitle r2bv-kn r2bv-publisher r2bv-organization r2bv-school r2bv-type r2bv-where r2bv-note r2bv-ordering) r2b-variables] 2) #@41 Set all global vars used by r2b to nil. (defalias 'r2b-clear-variables #[nil " @L A)" [r2b-variables vars nil] 3 (#$ . 5733)]) (defalias 'r2b-warning #[(&rest args) " \"\"\"\"\" \"\"" [t r2b-error-found princ apply format args r2b-log "\n" r2b-out-buf "% "] 4]) #@460 Set VAR to string value of FIELD, if any. If none, VAR is set to nil. If multiple fields appear, then separate values with the '\nand\t\t', unless UNIQUE is non-nil, in which case log a warning and just concatenate the values. Trim off leading blanks and tabs on first line, and trailing blanks and tabs of every line. Log a warning and set VAR to the empty string if REQUIRED is true. Capitalize as a title if CAPITALIZE is true. Returns value of VAR. (defalias 'r2b-get-field #[(var field &optional unique required capitalize) "\"eb\neQ#e!yU@!@!\f!Q# I\f]\f# \fQ \fQ rr ! L ?!+" [nil t not-past-end val item r2b-trace "snarfing %s" field re-search-forward "^" "\\b[ ]*\\(.*[^ \n]\\)[ ]*" r2b-match 1 0 looking-at "[ ]*$\\|%" "\\(.*[^ \n]\\)[ ]*$" "\n" unique r2b-warning "*Illegal multiple field %s %s" "\n and " capitalize capitalize-title var required r2b-require] 4 (#$ . 6046)]) #@76 Set VAR to the Nth subpattern in REGEXP matched by STRING, or nil if none. (defalias 'r2b-set-match #[(var n regexp string) " ; \" \f\fOL" [var string string-match regexp n] 4 (#$ . 7043)]) (byte-code "! B" [boundp r2b-month-abbrevs (("jan") ("feb") ("mar") ("apr") ("may") ("jun") ("jul") ("aug") ("sep") ("oct") ("nov") ("dec")) current-load-list] 2) #@58 Try to convert `r2bv-month' to a standard 3 letter name. (defalias 'r2b-convert-month #[nil "T \"-\n!\n@@\"!\nA\nS\n@@S!@L\nVL\nWL\n 8@S!ʉ)" [r2bv-month r2b-month-abbrevs months string-match "[^0-9]" read-from-string 0 13 r2b-warning "* Ridiculous month" nil] 4 (#$ . 7425)]) #@37 Parse buffer into global variables. (defalias 'r2b-snarf-input #[nil "!!qeb \"``{ \" !\"\" A $TQ$T$$x$xP$$;\"ӕO %'#$####\"%%#####)" [t case-fold-search r2b-trace "snarfing..." sit-for 0 r2b-in-buf princ " " r2b-log nil terpri r2b-get-field r2bv-author "%A" r2bv-editor "%E" r2b-set-match r2bv-primary-author 1 "\\b\\(\\w+\\)[ ]*\\($\\|,\\)" "" r2bv-date "%D" r2bv-year "[12][0-9][0-9][0-9]" "[^0-9]\\([0-9][0-9]\\)$" "19" r2bv-decade "..\\(..\\)" r2bv-month "[0-9]+/\\|[a-zA-Z]+" string-match "\\(.*\\)/$" r2b-convert-month r2bv-title "%T" r2bv-title-first-word 4 r2b-stop-regexp r2bv-annote "%X" r2bv-tr "%R" r2bv-address "%C" r2bv-institution "%I" r2bv-keywords "%K" r2bv-booktitle "%B" r2bv-journal "%J" r2bv-volume "%V" r2bv-number "%N" r2bv-pages "%P" r2bv-where "%W" r2bv-ordering "%O"] 6 (#$ . 7756)]) #@160 Print bibtex FIELD = {DATA} if DATA not null; precede with a comma and newline; if ABBREVS list is given, then try to replace the {DATA} with an abbreviation. (defalias 'r2b-put-field #[(field data &optional abbrevs) "/\"/ A& @* A@ɚA\"A\n#h̉O̔̕O̕O̕\\C\n#̉O̔OQ̕\\j\n#̉O̕OQ̕\\!!!\f!!\"̕V!!\f?!!," [data nil index multi-line nodelim match abbrevs assoc t "" string-match "[^0-9]" 0 "[\\~^]" "\\verb+" "+" 7 "[$&%#_{}]" "\\" 1 r2b-delimit-with-quote "\"" "{\"}" 2 princ ", \n " field " = " "{" ".*" 59 "\n" "}"] 7 (#$ . 8776)]) #@60 If any of VARS is null, set to empty string and log error. (defalias 'r2b-require #[(vars) "?\"<@!A!J?\"\"L" [vars r2b-require r2b-warning "*Missing value for field %s" ""] 3 (#$ . 9488)]) #@36 Set NEW to OLD and set OLD to nil. (defalias 'r2b-moveq '(macro . #[(new old) "\n E EE" [progn setq new old nil] 5 (#$ . 9706)])) #@46 Return t if NAME is the name of proceedings. (defalias 'r2b-isa-proceedings #[(name) "$\"$\f\"$ \"#A@\")" [name string-match "proceedings\\|conference" assoc r2b-proceedings-list r2b-booktitle-abbrevs match] 4 (#$ . 9847)]) #@80 Return t if NAME is a university or similar organization, but not a publisher. (defalias 'r2b-isa-university #[(name) "\"\"?" [name string-match "university" "press"] 3 (#$ . 10101)]) #@44 Generate bibtex based on global variables. (defalias 'r2b-barf-output #[nil "!!q\n \fQ !O!9@!ق!}!gn!ق\"!!݂\"!!߂\"!!!!$&\"&!E!3:$\\{\\\"{!$w!!\"O-O//!2!4!!2!! !\"&<#>\"@A#BC#DE\"F-\"G/\"H<#I$\"J\"K\"L\"M\"NO\"PQ\"R\"ST\"UV\"WX\"YZ\"[!+" [r2b-out-buf t nil match case-fold-search standard-output r2b-trace "...barfing" sit-for 0 r2bv-primary-author r2bv-decade r2bv-title-first-word r2bv-kn r2b-isa-proceedings r2bv-journal r2bv-booktitle r2b-isa-university r2bv-institution r2bv-organization r2bv-publisher r2bv-tr r2bv-note r2b-require r2bv-author inproceedings string-match "phd" r2bv-school phdthesis "master" mastersthesis "draft\\|unpublish" unpublished article incollection r2bv-editor "\\`personal communication\\'" r2bv-title misc proceedings "\\bisbn\\b" book "\\`\\(\\(.\\|\n\\)+\\)[ \n]+\\([^ \n]\\)+\\'" 1 r2bv-type 3 r2bv-number techreport manual r2bv-entry-kind (r2bv-year) r2b-error-found princ "\n% Warning -- Errors During Conversion Next Entry\n" "\n@" "( " r2b-put-field "author" "title" r2b-booktitle-abbrevs "year" r2bv-year "month" r2bv-month r2b-month-abbrevs "journal" r2b-journal-abbrevs "volume" r2bv-volume "type" "number" "booktitle" "editor" "publisher" "institution" "organization" "school" "pages" r2bv-pages "address" r2bv-address "note" "keywords" r2bv-keywords "where" r2bv-where "ordering" r2bv-ordering "annote" r2bv-annote " )\n"] 4 (#$ . 10305)]) #@91 Transform current bib entry and append to buffer OUTPUT; do "M-x r2b-help" for more info. (defalias 'r2b-convert-record #[(output-name) "\f\f!pqdb !\nqdbq#_#!y`#`\n } q~ b+" [nil not-done rec-begin rec-end output-name r2b-out-buf-name get-buffer-create r2b-out-buf r2b-in-buf r2b-log-name r2b-log re-search-forward "[^ \n]" t re-search-backward "^[ ]*$" 2 "^%" 0 r2b-clear-variables r2b-snarf-input r2b-barf-output] 5 (#$ . 12225) (list (read-string "Output to buffer: " r2b-out-buf-name))]) #@88 Transform current buffer and append to buffer OUTPUT; do "M-x r2b-help" for more info. (defalias 'r2b-convert-buffer #[(output-name) " !q )~eb!! ! #" [get-buffer-create r2b-log-name r2b-log erase-buffer message "Working, please be patient..." sit-for 0 r2b-convert-record output-name "Done, results in %s, errors in %s" r2b-out-buf-name] 5 (#$ . 12791) (list (read-string "Output to buffer: " r2b-out-buf-name))]) #@39 *Don't print help message when loaded (defvar r2b-load-quietly nil (#$ . -13236)) (byte-code "! B" [boundp r2b-help-message " Refer to Bibtex Bibliography Conversion\n\nA refer-style database is of the form:\n\n%A Joe Blow\n%T Great Thoughts I've Thought\n%D 1977\netc.\n\nThis utility converts these kind of databases to bibtex form, for\nusers of TeX and LaTex. Instructions:\n1. Visit the file containing the refer-style database.\n2. The command\n M-x r2b-convert-buffer\n converts the entire buffer, appending it's output by default in a\n buffer named *Out*, and logging progress and errors in a buffer\n named *Log*. The original file is never modified.\n Note that results are appended to *Out*, so if that buffer\n buffer already exists and contains material you don't want to\n save, you should kill it first.\n3. Switch to the buffer *Out* and save it as a named file.\n4. To convert a single refer-style entry, simply position the cursor\n at the entry and enter\n M-x r2b-convert-record\n Again output is appended to *Out* and errors are logged in *Log*.\n\nThis utility is very robust and pretty smart about determining the\ntype of the entry. It includes facilities for expanding refer macros\nto text, or substituting bibtex macros. Do M-x describe-variable on\n r2b-journal-abbrevs\n r2b-booktitle-abbrevs\n r2b-proceedings-list\nfor information on these features.\n\nIf you don't want to see this help message when you load this utility,\nthen include the following line in your .emacs file:\n (setq r2b-load-quietly t)\nTo see this message again, perform \n M-x r2b-help\nPlease send bug reports and suggestions to\n Henry Kautz\n kautz@research.att.com\n allegra!kautz" current-load-list] 2) #@21 Print help message. (defalias 'r2b-help #[nil "\n! q )" ["*Help*" princ r2b-help-message standard-output help-mode] 3 (#$ . 15034) nil]) (byte-code " !!" [r2b-load-quietly r2b-help message "r2b loaded" provide refer-to-bibtex] 2)