[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] Changes to reftex/lisp/reftex-ref.el,v
From: |
Ralf Angeli |
Subject: |
[AUCTeX-diffs] Changes to reftex/lisp/reftex-ref.el,v |
Date: |
Thu, 04 Oct 2012 20:03:27 +0000 |
CVSROOT: /sources/auctex
Module name: reftex
Changes by: Ralf Angeli <angeli> 12/10/04 20:03:25
Index: lisp/reftex-ref.el
===================================================================
RCS file: /sources/auctex/reftex/lisp/reftex-ref.el,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- lisp/reftex-ref.el 29 Dec 2008 19:22:48 -0000 1.38
+++ lisp/reftex-ref.el 4 Oct 2012 20:03:25 -0000 1.39
@@ -1,17 +1,16 @@
;;; reftex-ref.el --- code to create labels and references with RefTeX
-;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-;; 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2012 Free Software Foundation, Inc.
;; Author: Carsten Dominik <address@hidden>
;; Maintainer: address@hidden
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,19 +18,16 @@
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(eval-when-compile (require 'cl))
-(provide 'reftex-ref)
+
(require 'reftex-base)
(require 'reftex-parse)
-;;;
(defun reftex-label-location (&optional bound)
"Return the environment or macro which determines the label type at point.
@@ -79,8 +75,7 @@
file (not (eq t reftex-keep-temporary-buffers)))))
(if (not buf)
(list label typekey "" file comment "LOST LABEL. RESCAN TO FIX.")
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(save-restriction
(widen)
(goto-char 1)
@@ -208,7 +203,7 @@
(if naked "Naked Label: " "Label: ")
default))
- ;; Lets make sure that this is a valid label
+ ;; Let's make sure that this is a valid label
(cond
((string-match (concat "\\`\\(" (regexp-quote prefix)
@@ -423,12 +418,13 @@
;; Ensure access to scanning info and rescan buffer if prefix is '(4)
(reftex-access-scan-info current-prefix-arg)
- (let ((refstyle (when (and (boundp 'refstyle) refstyle) refstyle))
+ (let ((reftex-refstyle (when (and (boundp 'reftex-refstyle) reftex-refstyle)
+ reftex-refstyle))
(reftex-format-ref-function reftex-format-ref-function)
(form "\\ref{%s}")
label labels sep sep1 style-alist)
- (unless refstyle
+ (unless reftex-refstyle
(if reftex-ref-macro-prompt
(progn
;; Build a temporary list which handles more easily.
@@ -446,12 +442,12 @@
(if (> (car x) 31) " " "")
(cdr x)))
style-alist "\n")))))
- (setq refstyle (cdr (assoc key style-alist)))
- (unless refstyle
+ (setq reftex-refstyle (cdr (assoc key style-alist)))
+ (unless reftex-refstyle
(error "No reference macro associated with key `%c'" key))))
;; Get the first macro from `reftex-ref-style-alist' which
;; matches the first entry in the list of active styles.
- (setq refstyle
+ (setq reftex-refstyle
(or (caar (nth 2 (assoc (car (reftex-ref-style-list))
reftex-ref-style-alist)))
;; Use the first entry in r-r-s-a as a last resort.
@@ -502,13 +498,13 @@
(member (preceding-char) '(?\ ?\t ?\n ?~)))
(setq form (substring form 1)))
;; do we have a special format?
- (unless (string= refstyle "\\ref")
+ (unless (string= reftex-refstyle "\\ref")
(setq reftex-format-ref-function 'reftex-format-special))
;; ok, insert the reference
(if sep1 (insert sep1))
(insert
(if reftex-format-ref-function
- (funcall reftex-format-ref-function label form refstyle)
+ (funcall reftex-format-ref-function label form reftex-refstyle)
(format form label label)))
;; take out the initial ~ for good
(and (= ?~ (string-to-char form))
@@ -559,14 +555,12 @@
(delete-other-windows)
(setq reftex-call-back-to-this-buffer buf
reftex-latex-syntax-table (syntax-table))
- (let ((default-major-mode 'reftex-select-label-mode))
(if reftex-use-multiple-selection-buffers
(switch-to-buffer-other-window
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(reftex-make-selection-buffer-name typekey)))
(switch-to-buffer-other-window "*RefTeX Select*")
- (reftex-erase-buffer)))
+ (reftex-erase-buffer))
(unless (eq major-mode 'reftex-select-label-mode)
(reftex-select-label-mode))
(add-to-list 'selection-buffers (current-buffer))
@@ -574,7 +568,7 @@
(setq mode-line-format
(list "---- " 'mode-line-buffer-identification
" " 'global-mode-string " (" mode-name ")"
- " S<" 'refstyle ">"
+ " S<" 'reftex-refstyle ">"
" -%-"))
(cond
((= 0 (buffer-size))
@@ -833,7 +827,7 @@
package.\n\nThis is a generated function."
macro package)
(interactive)
- (let ((refstyle ,macro))
+ (let ((reftex-refstyle ,macro))
(reftex-reference))))))))
(defun reftex-format-special (label fmt refstyle)
@@ -852,8 +846,16 @@
(reftex-access-scan-info)
(let* ((wcfg (current-window-configuration))
(docstruct (symbol-value reftex-docstruct-symbol))
- (label (completing-read "Label: " docstruct
- (lambda (x) (stringp (car x))) t))
+ ;; If point is inside a \ref{} or \pageref{}, use that as
+ ;; default value.
+ (default (when (looking-back "\\\\\\(?:page\\)?ref{[-a-zA-Z0-9_*.:]*")
+ (reftex-this-word "-a-zA-Z0-9_*.:")))
+ (label (completing-read (if default
+ (format "Label (default %s): " default)
+ "Label: ")
+ docstruct
+ (lambda (x) (stringp (car x))) t nil nil
+ default))
(selection (assoc label docstruct))
(where (progn
(reftex-show-label-location selection t nil 'stay)
@@ -864,7 +866,6 @@
(goto-char where))
(reftex-unhighlight 0)))
+(provide 'reftex-ref)
-
-;;; arch-tag: 52f14032-fb76-4d31-954f-750c72415675
;;; reftex-ref.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [AUCTeX-diffs] Changes to reftex/lisp/reftex-ref.el,v,
Ralf Angeli <=