Mercurial > emacs
comparison lisp/textmodes/reftex.el @ 90133:4da4a09e8b1b
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-31
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 206-222)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 45-52)
- Update from CVS
- Update from CVS: texi Makefile.in CVS keyw cruft
- Update from CVS: ChangeLog tweaks
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 31 Mar 2005 09:58:14 +0000 |
parents | 72cf6261961e 89202ce14f61 |
children | f042e7c0fe20 |
comparison
equal
deleted
inserted
replaced
90132:4080fe8b4f0f | 90133:4da4a09e8b1b |
---|---|
1 ;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX | 1 ;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX |
2 ;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc. | 2 ;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004, 2005 |
3 ;; Free Software Foundation, Inc. | |
3 | 4 |
4 ;; Author: Carsten Dominik <dominik@science.uva.nl> | 5 ;; Author: Carsten Dominik <dominik@science.uva.nl> |
5 ;; Version: 4.26 | 6 ;; Version: 4.26 |
6 ;; Keywords: tex | 7 ;; Keywords: tex |
7 | 8 |
1414 (cond | 1415 (cond |
1415 ((and (>= key ?0) (<= key highest)) (- key ?0)) | 1416 ((and (>= key ?0) (<= key highest)) (- key ?0)) |
1416 ((= key ?\C-i) | 1417 ((= key ?\C-i) |
1417 (setq prefix (completing-read "Prefix: " xr-alist nil t)) | 1418 (setq prefix (completing-read "Prefix: " xr-alist nil t)) |
1418 (- len (length (memq (assoc prefix xr-alist) xr-alist)))) | 1419 (- len (length (memq (assoc prefix xr-alist) xr-alist)))) |
1419 (t (error "Illegal document selection [%c]" key))))))))) | 1420 (t (error "Invalid document selection [%c]" key))))))))) |
1420 | 1421 |
1421 ;;; ========================================================================= | 1422 ;;; ========================================================================= |
1422 ;;; | 1423 ;;; |
1423 ;;; Finding files | 1424 ;;; Finding files |
1424 | 1425 |
1425 (defun reftex-locate-file (file type master-dir &optional die) | 1426 (defun reftex-locate-file (file type master-dir &optional die) |
1426 "Find FILE of type TYPE in MASTER-DIR or on the path associcted with TYPE. | 1427 "Find FILE of type TYPE in MASTER-DIR or on the path associcted with TYPE. |
1427 If the file does not have any of the legal extensions for TYPE, | 1428 If the file does not have any of the valid extensions for TYPE, |
1428 try first the default extension and only then the naked file name. | 1429 try first the default extension and only then the naked file name. |
1429 When DIE is non-nil, throw an error if file not found." | 1430 When DIE is non-nil, throw an error if file not found." |
1430 (let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t))) | 1431 (let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t))) |
1431 (extensions (cdr (assoc type reftex-file-extensions))) | 1432 (extensions (cdr (assoc type reftex-file-extensions))) |
1432 (def-ext (car extensions)) | 1433 (def-ext (car extensions)) |
2165 | 2166 |
2166 (defun reftex-abbreviate-title (string) | 2167 (defun reftex-abbreviate-title (string) |
2167 (reftex-convert-string string "[-~ \t\n\r,;]" nil t t | 2168 (reftex-convert-string string "[-~ \t\n\r,;]" nil t t |
2168 5 40 nil 1 " " (nth 5 reftex-derive-label-parameters))) | 2169 5 40 nil 1 " " (nth 5 reftex-derive-label-parameters))) |
2169 | 2170 |
2170 (defun reftex-convert-string (string split-re illegal-re dot keep-fp | 2171 (defun reftex-convert-string (string split-re invalid-re dot keep-fp |
2171 nwords maxchar illegal abbrev sep | 2172 nwords maxchar invalid abbrev sep |
2172 ignore-words &optional downcase) | 2173 ignore-words &optional downcase) |
2173 "Convert a string (a sentence) to something shorter. | 2174 "Convert a string (a sentence) to something shorter. |
2174 SPLIT-RE is the regular expression used to split the string into words. | 2175 SPLIT-RE is the regular expression used to split the string into words. |
2175 ILLEGAL-RE matches characters which are illegal in the final string. | 2176 INVALID-RE matches characters which are invalid in the final string. |
2176 DOT t means add dots to abbreviated words. | 2177 DOT t means add dots to abbreviated words. |
2177 KEEP-FP t means to keep a final punctuation when applicable. | 2178 KEEP-FP t means to keep a final punctuation when applicable. |
2178 NWORDS Number of words to use. | 2179 NWORDS Number of words to use. |
2179 MAXCHAR Maximum number of characters in the final string. | 2180 MAXCHAR Maximum number of characters in the final string. |
2180 ILLEGAL nil: Throw away any words containing stuff matched with ILLEGAL-RE. | 2181 INVALID nil: Throw away any words containing stuff matched with INVALID-RE. |
2181 t: Throw away only the matched part, not the whole word. | 2182 t: Throw away only the matched part, not the whole word. |
2182 ABBREV nil: Never abbreviate words. | 2183 ABBREV nil: Never abbreviate words. |
2183 t: Always abbreviate words (see `reftex-abbrev-parameters'). | 2184 t: Always abbreviate words (see `reftex-abbrev-parameters'). |
2184 not t and not nil: Abbreviate words if necessary to shorten | 2185 not t and not nil: Abbreviate words if necessary to shorten |
2185 string below MAXCHAR. | 2186 string below MAXCHAR. |
2186 SEP String separating different words in the output string. | 2187 SEP String separating different words in the output string. |
2187 IGNORE-WORDS List of words which should be removed from the string." | 2188 IGNORE-WORDS List of words which should be removed from the string." |
2188 | 2189 |
2189 (let* ((words0 (split-string string (or split-re "[ \t\n\r]"))) | 2190 (let* ((words0 (split-string string (or split-re "[ \t\n\r]"))) |
2190 (reftex-label-illegal-re (or illegal-re "\000")) | 2191 (reftex-label-illegal-re (or invalid-re "\000")) |
2191 (abbrev-re (concat | 2192 (abbrev-re (concat |
2192 "\\`\\(" | 2193 "\\`\\(" |
2193 (make-string (nth 0 reftex-abbrev-parameters) ?.) | 2194 (make-string (nth 0 reftex-abbrev-parameters) ?.) |
2194 "[" (nth 2 reftex-abbrev-parameters) "]*" | 2195 "[" (nth 2 reftex-abbrev-parameters) "]*" |
2195 "\\)" | 2196 "\\)" |
2201 (while (setq word (pop words0)) | 2202 (while (setq word (pop words0)) |
2202 (if downcase (setq word (downcase word))) | 2203 (if downcase (setq word (downcase word))) |
2203 (cond | 2204 (cond |
2204 ((member (downcase word) ignore-words)) | 2205 ((member (downcase word) ignore-words)) |
2205 ((string-match reftex-label-illegal-re word) | 2206 ((string-match reftex-label-illegal-re word) |
2206 (when illegal | 2207 (when invalid |
2207 (while (string-match reftex-label-illegal-re word) | 2208 (while (string-match reftex-label-illegal-re word) |
2208 (setq word (replace-match "" nil nil word))) | 2209 (setq word (replace-match "" nil nil word))) |
2209 (push word words))) | 2210 (push word words))) |
2210 (t | 2211 (t |
2211 (push word words)))) | 2212 (push word words)))) |