comparison lisp/textmodes/reftex-ref.el @ 111422:2eee976277c5

Silence reftex compilation. * lisp/textmodes/reftex-toc.el (reftex-toc-do-promote) (reftex-toc-promote-prepare): Pass `delta' as an explicit argument. (reftex-toc-promote-action): Doc fix. * lisp/textmodes/reftex-sel.el (reftex-select-item): Give local variables `prompt', `data' a prefix. (reftex-select-post-command-hook, reftex-select-callback) (reftex-select-mouse-accept, reftex-select-read-cite): Update for above name changes. * lisp/textmodes/reftex-ref.el (reftex-reference): Rename local variable `refstyle' to reftex-refstyle. (reftex-offer-label-menu): Update for above name change. * lisp/textmodes/reftex-sel.el (reftex-select-toggle-varioref): Update for `refstyle' name change.
author Glenn Morris <rgm@gnu.org>
date Sat, 06 Nov 2010 12:11:38 -0700
parents 280c8ae2476d
children e19cfb89c13c
comparison
equal deleted inserted replaced
111421:ac911360c429 111422:2eee976277c5
178 (string-match "SECTION HEADING NOT FOUND" default) 178 (string-match "SECTION HEADING NOT FOUND" default)
179 (string-match "HOOK ERROR" default) 179 (string-match "HOOK ERROR" default)
180 (string-match "^[ \t]*$" default)) 180 (string-match "^[ \t]*$" default))
181 (setq default prefix 181 (setq default prefix
182 force-prompt t) ; need to prompt 182 force-prompt t) ; need to prompt
183 (setq default 183 (setq default
184 (concat prefix 184 (concat prefix
185 (funcall reftex-string-to-label-function default))) 185 (funcall reftex-string-to-label-function default)))
186 186
187 ;; Make it unique. 187 ;; Make it unique.
188 (setq default (reftex-uniquify-label default nil "-")))) 188 (setq default (reftex-uniquify-label default nil "-"))))
189 189
225 225
226 ;; Look it up in the label list 226 ;; Look it up in the label list
227 ((setq entry (assoc label 227 ((setq entry (assoc label
228 (symbol-value reftex-docstruct-symbol))) 228 (symbol-value reftex-docstruct-symbol)))
229 (ding) 229 (ding)
230 (if (y-or-n-p 230 (if (y-or-n-p
231 (format "Label '%s' exists. Use anyway? " label)) 231 (format "Label '%s' exists. Use anyway? " label))
232 (setq valid t))) 232 (setq valid t)))
233 233
234 ;; Label is ok 234 ;; Label is ok
235 (t 235 (t
292 292
293 (defun reftex-latin1-to-ascii (string) 293 (defun reftex-latin1-to-ascii (string)
294 ;; Translate the upper 128 chars in the Latin-1 charset to ASCII equivalents 294 ;; Translate the upper 128 chars in the Latin-1 charset to ASCII equivalents
295 (let ((tab "@@@@@@@@@@@@@@@@@@'@@@@@@@@@@@@@ icLxY|S\"ca<--R-o|23'uq..1o>423?AAAAAAACEEEEIIIIDNOOOOOXOUUUUYP3aaaaaaaceeeeiiiidnooooo:ouuuuypy") 295 (let ((tab "@@@@@@@@@@@@@@@@@@'@@@@@@@@@@@@@ icLxY|S\"ca<--R-o|23'uq..1o>423?AAAAAAACEEEEIIIIDNOOOOOXOUUUUYP3aaaaaaaceeeeiiiidnooooo:ouuuuypy")
296 (emacsp (not (featurep 'xemacs)))) 296 (emacsp (not (featurep 'xemacs))))
297 (mapconcat 297 (mapconcat
298 (lambda (c) 298 (lambda (c)
299 (cond ((and (> c 127) (< c 256)) ; 8 bit Latin-1 299 (cond ((and (> c 127) (< c 256)) ; 8 bit Latin-1
300 (char-to-string (aref tab (- c 128)))) 300 (char-to-string (aref tab (- c 128))))
301 ((and emacsp ; Not for XEmacs 301 ((and emacsp ; Not for XEmacs
302 (> c 2175) (< c 2304)) ; Mule Latin-1 302 (> c 2175) (< c 2304)) ; Mule Latin-1
428 (setq type (reftex-guess-label-type))) 428 (setq type (reftex-guess-label-type)))
429 (setq cut (cdr type) 429 (setq cut (cdr type)
430 type (car type)) 430 type (car type))
431 (setq type (reftex-query-label-type)))) 431 (setq type (reftex-query-label-type))))
432 432
433 (let* ((refstyle 433 (let* ((reftex-refstyle
434 (cond ((reftex-typekey-check type reftex-vref-is-default) "\\vref") 434 (cond ((reftex-typekey-check type reftex-vref-is-default) "\\vref")
435 ((reftex-typekey-check type reftex-fref-is-default) "\\fref") 435 ((reftex-typekey-check type reftex-fref-is-default) "\\fref")
436 (t "\\ref"))) 436 (t "\\ref")))
437 (reftex-format-ref-function reftex-format-ref-function) 437 (reftex-format-ref-function reftex-format-ref-function)
438 (form "\\ref{%s}") 438 (form "\\ref{%s}")
450 (setq labels (list (list (mapconcat 'car (cdr labels) ",") 450 (setq labels (list (list (mapconcat 'car (cdr labels) ",")
451 (cdr (nth 1 labels)))))) 451 (cdr (nth 1 labels))))))
452 (setq type (nth 1 (car labels)) 452 (setq type (nth 1 (car labels))
453 form (or (cdr (assoc type reftex-typekey-to-format-alist)) 453 form (or (cdr (assoc type reftex-typekey-to-format-alist))
454 form)) 454 form))
455 455
456 (cond 456 (cond
457 (no-insert 457 (no-insert
458 ;; Just return the first label 458 ;; Just return the first label
459 (car (car labels))) 459 (car (car labels)))
460 ((null labels) 460 ((null labels)
464 (while labels 464 (while labels
465 (setq label (car (car labels)) 465 (setq label (car (car labels))
466 sep (nth 2 (car labels)) 466 sep (nth 2 (car labels))
467 sep1 (cdr (assoc sep reftex-multiref-punctuation)) 467 sep1 (cdr (assoc sep reftex-multiref-punctuation))
468 labels (cdr labels)) 468 labels (cdr labels))
469 (when cut 469 (when cut
470 (backward-delete-char cut) 470 (backward-delete-char cut)
471 (setq cut nil)) 471 (setq cut nil))
472 472
473 ;; remove ~ if we do already have a space 473 ;; remove ~ if we do already have a space
474 (when (and (= ?~ (string-to-char form)) 474 (when (and (= ?~ (string-to-char form))
475 (member (preceding-char) '(?\ ?\t ?\n ?~))) 475 (member (preceding-char) '(?\ ?\t ?\n ?~)))
476 (setq form (substring form 1))) 476 (setq form (substring form 1)))
477 ;; do we have a special format? 477 ;; do we have a special format?
478 (setq reftex-format-ref-function 478 (setq reftex-format-ref-function
479 (cond 479 (cond
480 ((string= refstyle "\\vref") 'reftex-format-vref) 480 ((string= reftex-refstyle "\\vref") 'reftex-format-vref)
481 ((string= refstyle "\\fref") 'reftex-format-fref) 481 ((string= reftex-refstyle "\\fref") 'reftex-format-fref)
482 ((string= refstyle "\\Fref") 'reftex-format-Fref) 482 ((string= reftex-refstyle "\\Fref") 'reftex-format-Fref)
483 (t reftex-format-ref-function))) 483 (t reftex-format-ref-function)))
484 ;; ok, insert the reference 484 ;; ok, insert the reference
485 (if sep1 (insert sep1)) 485 (if sep1 (insert sep1))
486 (insert 486 (insert
487 (if reftex-format-ref-function 487 (if reftex-format-ref-function
499 (case-fold-search t) 499 (case-fold-search t)
500 (bound (max (point-min) (- (point) 35))) 500 (bound (max (point-min) (- (point) 35)))
501 matched cell) 501 matched cell)
502 (save-excursion 502 (save-excursion
503 (while (and (setq cell (pop words)) 503 (while (and (setq cell (pop words))
504 (not (setq matched 504 (not (setq matched
505 (re-search-backward (car cell) bound t)))))) 505 (re-search-backward (car cell) bound t))))))
506 (if matched 506 (if matched
507 (cons (cdr cell) (- (match-end 0) (match-end 1))) 507 (cons (cdr cell) (- (match-end 0) (match-end 1)))
508 nil))) 508 nil)))
509 509
547 (add-to-list 'selection-buffers (current-buffer)) 547 (add-to-list 'selection-buffers (current-buffer))
548 (setq truncate-lines t) 548 (setq truncate-lines t)
549 (setq mode-line-format 549 (setq mode-line-format
550 (list "---- " 'mode-line-buffer-identification 550 (list "---- " 'mode-line-buffer-identification
551 " " 'global-mode-string " (" mode-name ")" 551 " " 'global-mode-string " (" mode-name ")"
552 " S<" 'refstyle ">" 552 " S<" 'reftex-refstyle ">"
553 " -%-")) 553 " -%-"))
554 (cond 554 (cond
555 ((= 0 (buffer-size)) 555 ((= 0 (buffer-size))
556 (let ((buffer-read-only nil)) 556 (let ((buffer-read-only nil))
557 (message "Creating Selection Buffer...") 557 (message "Creating Selection Buffer...")
562 nil ; index 562 nil ; index
563 files 563 files
564 context 564 context
565 counter 565 counter
566 commented 566 commented
567 (or here-I-am offset) 567 (or here-I-am offset)
568 prefix 568 prefix
569 nil ; no a toc buffer 569 nil ; no a toc buffer
570 )))) 570 ))))
571 (here-I-am 571 (here-I-am
572 (setq offset (reftex-get-offset buf here-I-am typekey))) 572 (setq offset (reftex-get-offset buf here-I-am typekey)))
573 (t (setq offset t))) 573 (t (setq offset t)))
574 (setq buffer-read-only t) 574 (setq buffer-read-only t)
688 (file (nth 3 data))) 688 (file (nth 3 data)))
689 (reftex-access-scan-info arg file))))) 689 (reftex-access-scan-info arg file)))))
690 690
691 (defun reftex-query-label-type () 691 (defun reftex-query-label-type ()
692 ;; Ask for label type 692 ;; Ask for label type
693 (let ((key (reftex-select-with-char 693 (let ((key (reftex-select-with-char
694 reftex-type-query-prompt reftex-type-query-help 3))) 694 reftex-type-query-prompt reftex-type-query-help 3)))
695 (unless (member (char-to-string key) reftex-typekey-list) 695 (unless (member (char-to-string key) reftex-typekey-list)
696 (error "No such label type: %s" (char-to-string key))) 696 (error "No such label type: %s" (char-to-string key)))
697 (char-to-string key))) 697 (char-to-string key)))
698 698
699 (defun reftex-show-label-location (data forward no-revisit 699 (defun reftex-show-label-location (data forward no-revisit
700 &optional stay error) 700 &optional stay error)
701 ;; View the definition site of a label in another window. 701 ;; View the definition site of a label in another window.
702 ;; DATA is an entry from the docstruct list. 702 ;; DATA is an entry from the docstruct list.
703 ;; FORWARD indicates if the label is likely forward from current point. 703 ;; FORWARD indicates if the label is likely forward from current point.
704 ;; NO-REVISIT means do not load a file to show this label. 704 ;; NO-REVISIT means do not load a file to show this label.
716 (unless file 716 (unless file
717 (funcall errorf "Unknown label - reparse might help") 717 (funcall errorf "Unknown label - reparse might help")
718 (throw 'exit nil)) 718 (throw 'exit nil))
719 719
720 ;; Goto the file in another window 720 ;; Goto the file in another window
721 (setq buffer 721 (setq buffer
722 (if no-revisit 722 (if no-revisit
723 (reftex-get-buffer-visiting file) 723 (reftex-get-buffer-visiting file)
724 (reftex-get-file-buffer-force 724 (reftex-get-file-buffer-force
725 file (not reftex-keep-temporary-buffers)))) 725 file (not reftex-keep-temporary-buffers))))
726 (if buffer 726 (if buffer
782 (reftex-highlight 0 (1+ (- beg-hlt beg)) (1+ (- end-hlt beg))) 782 (reftex-highlight 0 (1+ (- beg-hlt beg)) (1+ (- end-hlt beg)))
783 (if (reftex-refontify) 783 (if (reftex-refontify)
784 (when (or (not (eq major-mode 'latex-mode)) 784 (when (or (not (eq major-mode 'latex-mode))
785 (not font-lock-mode)) 785 (not font-lock-mode))
786 (latex-mode) 786 (latex-mode)
787 (run-hook-with-args 787 (run-hook-with-args
788 'reftex-pre-refontification-functions 788 'reftex-pre-refontification-functions
789 reftex-call-back-to-this-buffer 'reftex-hidden) 789 reftex-call-back-to-this-buffer 'reftex-hidden)
790 (turn-on-font-lock)) 790 (turn-on-font-lock))
791 (when (or (not (eq major-mode 'fundamental-mode)) 791 (when (or (not (eq major-mode 'fundamental-mode))
792 font-lock-mode) 792 font-lock-mode)
837 (reftex-show-label-location selection t nil 'stay) 837 (reftex-show-label-location selection t nil 'stay)
838 (point-marker)))) 838 (point-marker))))
839 (unless other-window 839 (unless other-window
840 (set-window-configuration wcfg) 840 (set-window-configuration wcfg)
841 (switch-to-buffer (marker-buffer where)) 841 (switch-to-buffer (marker-buffer where))
842 (goto-char where)) 842 (goto-char where))
843 (reftex-unhighlight 0))) 843 (reftex-unhighlight 0)))
844 844
845 845
846
847 ;; arch-tag: 52f14032-fb76-4d31-954f-750c72415675
848 ;;; reftex-ref.el ends here 846 ;;; reftex-ref.el ends here