comparison lisp/textmodes/reftex-dcr.el @ 29775:31536c6cf2e3

* textmodes/reftex.el (reftex-find-citation-regexp-format): Support for bibentry. (reftex-compile-variables): Fixed problem with end of section-re. * texmodes/reftex-dcr.el (reftex-view-crossref, reftex-view-crossref-from-bibtex): Deal with changed `reftex-find-citation-regexp-format'. (reftex-view-regexp-match, reftex-view-crossref-from-bibtex): Replaced `remprop' with `put'. (reftex-view-crossref, reftex-view-crossref-when-idle): Support for bibentry. * textmodes/reftex-vars.el (reftex-cite-format-builtin): New entry for bibentry package. * textmodes/reftex-parse.el (reftex-locate-bibliography-files): Regexp also matches "\nobibliography". * textmodes/reftex-global.el (reftex-renumber-simple-labels): Call `reftex-ensure-write-access' before doing anything. (reftex-ensure-write-access): New function.
author Carsten Dominik <dominik@science.uva.nl>
date Tue, 20 Jun 2000 12:52:00 +0000
parents 0b645a4a64fa
children 5eec8d1d09f0
comparison
equal deleted inserted replaced
29774:8eff9cc9cbae 29775:31536c6cf2e3
1 ;;; reftex-dcr.el - Viewing cross references and citations with RefTeX 1 ;;; reftex-dcr.el - Viewing cross references and citations with RefTeX
2 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4 ;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4 ;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5 ;; Version: 4.11 5 ;; Version: 4.14
6 ;; 6 ;;
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
9 9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify 10 ;; GNU Emacs is free software; you can redistribute it and/or modify
54 (error "Not on a crossref macro argument")) 54 (error "Not on a crossref macro argument"))
55 55
56 (setq reftex-call-back-to-this-buffer (current-buffer)) 56 (setq reftex-call-back-to-this-buffer (current-buffer))
57 57
58 (cond 58 (cond
59 ((string-match "\\`\\\\cite\\|cite\\*?\\'" macro) 59 ((string-match "\\`\\\\cite\\|cite\\*?\\'\\|bibentry" macro)
60 ;; A citation macro: search for bibitems or BibTeX entries 60 ;; A citation macro: search for bibitems or BibTeX entries
61 (setq dw (reftex-view-cr-cite arg key auto-how))) 61 (setq dw (reftex-view-cr-cite arg key auto-how)))
62 ((string-match "\\`\\\\ref\\|ref\\(range\\)?\\*?\\'" macro) 62 ((string-match "\\`\\\\ref\\|ref\\(range\\)?\\*?\\'" macro)
63 ;; A reference macro: search for labels 63 ;; A reference macro: search for labels
64 (setq dw (reftex-view-cr-ref arg key auto-how))) 64 (setq dw (reftex-view-cr-ref arg key auto-how)))
73 ((equal macro "\\bibitem") 73 ((equal macro "\\bibitem")
74 ;; A bibitem macro: search for citations 74 ;; A bibitem macro: search for citations
75 (reftex-access-scan-info arg) 75 (reftex-access-scan-info arg)
76 (setq dw (reftex-view-regexp-match 76 (setq dw (reftex-view-regexp-match
77 (format reftex-find-citation-regexp-format (regexp-quote key)) 77 (format reftex-find-citation-regexp-format (regexp-quote key))
78 3 nil nil))) 78 4 nil nil)))
79 ((member macro reftex-macros-with-index) 79 ((member macro reftex-macros-with-index)
80 (reftex-access-scan-info arg) 80 (reftex-access-scan-info arg)
81 (setq dw (reftex-view-regexp-match 81 (setq dw (reftex-view-regexp-match
82 (format reftex-find-index-entry-regexp-format 82 (format reftex-find-index-entry-regexp-format
83 (regexp-quote key)) 83 (regexp-quote key))
236 reftex-mouse-view-crossref))) 236 reftex-mouse-view-crossref)))
237 ;; Quick precheck if this might be a relevant spot 237 ;; Quick precheck if this might be a relevant spot
238 ;; FIXME: Can fail with backslash in comment 238 ;; FIXME: Can fail with backslash in comment
239 (save-excursion 239 (save-excursion
240 (search-backward "\\" nil t) 240 (search-backward "\\" nil t)
241 (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\)")) 241 (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\|bibentry\\)"))
242 242
243 (condition-case nil 243 (condition-case nil
244 (let ((current-prefix-arg nil)) 244 (let ((current-prefix-arg nil))
245 (cond 245 (cond
246 ((eq reftex-auto-view-crossref t) 246 ((eq reftex-auto-view-crossref t)
355 link to a document, call the function with with a prefix arg. 355 link to a document, call the function with with a prefix arg.
356 Calling this function several times find successive citation locations." 356 Calling this function several times find successive citation locations."
357 (interactive "P") 357 (interactive "P")
358 (when arg 358 (when arg
359 ;; Break connection to reference buffer 359 ;; Break connection to reference buffer
360 (remprop 'reftex-bibtex-view-cite-locations :ref-buffer)) 360 (put 'reftex-bibtex-view-cite-locations :ref-buffer nil))
361 (let ((ref-buffer (get 'reftex-bibtex-view-cite-locations :ref-buffer))) 361 (let ((ref-buffer (get 'reftex-bibtex-view-cite-locations :ref-buffer)))
362 ;; Establish connection to reference buffer 362 ;; Establish connection to reference buffer
363 (unless ref-buffer 363 (unless ref-buffer
364 (setq ref-buffer 364 (setq ref-buffer
365 (save-excursion 365 (save-excursion
380 (progn 380 (progn
381 (goto-char (match-beginning 1)) 381 (goto-char (match-beginning 1))
382 (reftex-view-regexp-match 382 (reftex-view-regexp-match
383 (format reftex-find-citation-regexp-format 383 (format reftex-find-citation-regexp-format
384 (regexp-quote (match-string 1))) 384 (regexp-quote (match-string 1)))
385 3 arg ref-buffer)) 385 4 arg ref-buffer))
386 (error "Cannot find citation key in BibTeX entry")))) 386 (error "Cannot find citation key in BibTeX entry"))))
387 387
388 (defun reftex-view-regexp-match (re &optional highlight-group new ref-buffer) 388 (defun reftex-view-regexp-match (re &optional highlight-group new ref-buffer)
389 ;; Search for RE in current document or in the document of REF-BUFFER. 389 ;; Search for RE in current document or in the document of REF-BUFFER.
390 ;; Continue the search, if the same re was searched last. 390 ;; Continue the search, if the same re was searched last.
416 (put 'reftex-view-regexp-match :cnt (incf cnt)) 416 (put 'reftex-view-regexp-match :cnt (incf cnt))
417 (reftex-highlight 0 (match-beginning highlight-group) 417 (reftex-highlight 0 (match-beginning highlight-group)
418 (match-end highlight-group)) 418 (match-end highlight-group))
419 (add-hook 'pre-command-hook 'reftex-highlight-shall-die) 419 (add-hook 'pre-command-hook 'reftex-highlight-shall-die)
420 (setq pop-window (selected-window))) 420 (setq pop-window (selected-window)))
421 (remprop 'reftex-view-regexp-match :props) 421 (put 'reftex-view-regexp-match :props nil)
422 (or cont (set-window-configuration window-conf))) 422 (or cont (set-window-configuration window-conf)))
423 (select-window current-window) 423 (select-window current-window)
424 (if match 424 (if match
425 (progn 425 (progn
426 (message "Match Nr. %s" cnt) 426 (message "Match Nr. %s" cnt)