changeset 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 ac911360c429
children e0d9a22430d9
files lisp/ChangeLog lisp/textmodes/reftex-ref.el lisp/textmodes/reftex-sel.el lisp/textmodes/reftex-toc.el
diffstat 4 files changed, 78 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Nov 06 11:51:11 2010 -0700
+++ b/lisp/ChangeLog	Sat Nov 06 12:11:38 2010 -0700
@@ -1,5 +1,21 @@
 2010-11-06  Glenn Morris  <rgm@gnu.org>
 
+	* textmodes/reftex-toc.el (reftex-toc-do-promote)
+	(reftex-toc-promote-prepare): Pass `delta' as an explicit argument.
+	(reftex-toc-promote-action): Doc fix.
+
+	* 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.
+
+	* textmodes/reftex-ref.el (reftex-reference): Rename local variable
+	`refstyle' to reftex-refstyle.
+	(reftex-offer-label-menu): Update for above name change.
+	* textmodes/reftex-sel.el (reftex-select-toggle-varioref): Update for
+	`refstyle' name change.
+
 	* vc/emerge.el (emerge-eval-in-buffer): Remove, and replace all uses
 	with with-current-buffer.
 	(diff, template): Give dynamic local variables a prefix.
--- a/lisp/textmodes/reftex-ref.el	Sat Nov 06 11:51:11 2010 -0700
+++ b/lisp/textmodes/reftex-ref.el	Sat Nov 06 12:11:38 2010 -0700
@@ -180,8 +180,8 @@
                 (string-match "^[ \t]*$" default))
             (setq default prefix
                   force-prompt t)       ; need to prompt
-          (setq default 
-                (concat prefix 
+          (setq default
+                (concat prefix
                         (funcall reftex-string-to-label-function default)))
 
           ;; Make it unique.
@@ -227,7 +227,7 @@
              ((setq entry (assoc label
                                  (symbol-value reftex-docstruct-symbol)))
               (ding)
-              (if (y-or-n-p 
+              (if (y-or-n-p
                    (format "Label '%s' exists. Use anyway? " label))
                   (setq valid t)))
 
@@ -294,7 +294,7 @@
   ;; Translate the upper 128 chars in the Latin-1 charset to ASCII equivalents
   (let ((tab "@@@@@@@@@@@@@@@@@@'@@@@@@@@@@@@@ icLxY|S\"ca<--R-o|23'uq..1o>423?AAAAAAACEEEEIIIIDNOOOOOXOUUUUYP3aaaaaaaceeeeiiiidnooooo:ouuuuypy")
         (emacsp (not (featurep 'xemacs))))
-    (mapconcat 
+    (mapconcat
      (lambda (c)
        (cond ((and (> c 127) (< c 256))                 ; 8 bit Latin-1
               (char-to-string (aref tab (- c 128))))
@@ -430,7 +430,7 @@
               type (car type))
       (setq type (reftex-query-label-type))))
 
-  (let* ((refstyle 
+  (let* ((reftex-refstyle
           (cond ((reftex-typekey-check type reftex-vref-is-default) "\\vref")
                 ((reftex-typekey-check type reftex-fref-is-default) "\\fref")
                 (t "\\ref")))
@@ -452,7 +452,7 @@
     (setq type (nth 1 (car labels))
           form (or (cdr (assoc type reftex-typekey-to-format-alist))
                    form))
-    
+
     (cond
      (no-insert
       ;; Just return the first label
@@ -466,7 +466,7 @@
               sep (nth 2 (car labels))
               sep1 (cdr (assoc sep reftex-multiref-punctuation))
               labels (cdr labels))
-        (when cut 
+        (when cut
           (backward-delete-char cut)
           (setq cut nil))
 
@@ -477,9 +477,9 @@
         ;; do we have a special format?
         (setq reftex-format-ref-function
               (cond
-               ((string= refstyle "\\vref") 'reftex-format-vref)
-               ((string= refstyle "\\fref") 'reftex-format-fref)
-               ((string= refstyle "\\Fref") 'reftex-format-Fref)
+               ((string= reftex-refstyle "\\vref") 'reftex-format-vref)
+               ((string= reftex-refstyle "\\fref") 'reftex-format-fref)
+               ((string= reftex-refstyle "\\Fref") 'reftex-format-Fref)
                (t reftex-format-ref-function)))
         ;; ok, insert the reference
         (if sep1 (insert sep1))
@@ -501,7 +501,7 @@
         matched cell)
     (save-excursion
       (while (and (setq cell (pop words))
-                  (not (setq matched 
+                  (not (setq matched
                              (re-search-backward (car cell) bound t))))))
     (if matched
         (cons (cdr cell) (- (match-end 0) (match-end 1)))
@@ -549,7 +549,7 @@
               (setq mode-line-format
                     (list "----  " 'mode-line-buffer-identification
                           "  " 'global-mode-string "   (" mode-name ")"
-                          "  S<" 'refstyle ">"
+                          "  S<" 'reftex-refstyle ">"
                           " -%-"))
               (cond
                ((= 0 (buffer-size))
@@ -564,9 +564,9 @@
                                 context
                                 counter
                                 commented
-                                (or here-I-am offset) 
+                                (or here-I-am offset)
                                 prefix
-                                nil  ; no a toc buffer 
+                                nil  ; no a toc buffer
                                 ))))
                (here-I-am
                 (setq offset (reftex-get-offset buf here-I-am typekey)))
@@ -690,13 +690,13 @@
 
 (defun reftex-query-label-type ()
   ;; Ask for label type
-  (let ((key (reftex-select-with-char 
+  (let ((key (reftex-select-with-char
               reftex-type-query-prompt reftex-type-query-help 3)))
     (unless (member (char-to-string key) reftex-typekey-list)
       (error "No such label type: %s" (char-to-string key)))
     (char-to-string key)))
 
-(defun reftex-show-label-location (data forward no-revisit 
+(defun reftex-show-label-location (data forward no-revisit
                                         &optional stay error)
   ;; View the definition site of a label in another window.
   ;; DATA is an entry from the docstruct list.
@@ -718,7 +718,7 @@
         (throw 'exit nil))
 
       ;; Goto the file in another window
-      (setq buffer 
+      (setq buffer
             (if no-revisit
                 (reftex-get-buffer-visiting file)
               (reftex-get-file-buffer-force
@@ -784,7 +784,7 @@
             (when (or (not (eq major-mode 'latex-mode))
                       (not font-lock-mode))
               (latex-mode)
-              (run-hook-with-args 
+              (run-hook-with-args
                'reftex-pre-refontification-functions
                reftex-call-back-to-this-buffer 'reftex-hidden)
               (turn-on-font-lock))
@@ -839,10 +839,8 @@
     (unless other-window
       (set-window-configuration wcfg)
       (switch-to-buffer (marker-buffer where))
-      (goto-char where))      
+      (goto-char where))
     (reftex-unhighlight 0)))
 
 
-
-;; arch-tag: 52f14032-fb76-4d31-954f-750c72415675
 ;;; reftex-ref.el ends here
--- a/lisp/textmodes/reftex-sel.el	Sat Nov 06 11:51:11 2010 -0700
+++ b/lisp/textmodes/reftex-sel.el	Sat Nov 06 12:11:38 2010 -0700
@@ -369,22 +369,21 @@
 (defvar reftex-last-line nil)
 (defvar reftex-select-marked nil)
 
-(defun reftex-select-item (prompt help-string keymap
+(defun reftex-select-item (reftex-select-prompt help-string keymap
                                   &optional offset
                                   call-back cb-flag)
-;; Select an item, using PROMPT. The function returns a key indicating
-;; an exit status, along with a data structure indicating which item was
-;; selected.
-;; HELP-STRING contains help.  KEYMAP is a keymap with the available
-;; selection commands.
-;; OFFSET can be a label list item which will be selected at start.
-;; When it is t, point will start out at the beginning of the buffer.
-;; Any other value will cause restart where last selection left off.
-;; When CALL-BACK is given, it is a function which is called with the index
-;; of the element.
-;; CB-FLAG is the initial value of that flag.
-
-  (let* (ev data last-data (selection-buffer (current-buffer)))
+  ;; Select an item, using REFTEX-SELECT-PROMPT.
+  ;; The function returns a key indicating an exit status, along with a
+  ;; data structure indicating which item was selected.
+  ;; HELP-STRING contains help.  KEYMAP is a keymap with the available
+  ;; selection commands.
+  ;; OFFSET can be a label list item which will be selected at start.
+  ;; When it is t, point will start out at the beginning of the buffer.
+  ;; Any other value will cause restart where last selection left off.
+  ;; When CALL-BACK is given, it is a function which is called with the index
+  ;; of the element.
+  ;; CB-FLAG is the initial value of that flag.
+  (let (ev reftex-select-data last-data (selection-buffer (current-buffer)))
 
     (setq reftex-select-marked nil)
 
@@ -404,7 +403,7 @@
             (use-local-map keymap)
             (add-hook 'pre-command-hook 'reftex-select-pre-command-hook nil t)
             (add-hook 'post-command-hook 'reftex-select-post-command-hook nil t)
-            (princ prompt)
+            (princ reftex-select-prompt)
             (set-marker reftex-recursive-edit-marker (point))
             ;; XEmacs does not run post-command-hook here
             (and (featurep 'xemacs) (run-hooks 'post-command-hook))
@@ -426,19 +425,18 @@
     (reftex-kill-buffer "*RefTeX Help*")
     (setq reftex-callback-fwd (not reftex-callback-fwd)) ;; ;-)))
     (message "")
-    (list ev data last-data)))
+    (list ev reftex-select-data last-data)))
 
 ;; The following variables are all bound dynamically in `reftex-select-item'.
 ;; The defvars are here only to silence the byte compiler.
 
 (defvar found-list)
 (defvar cb-flag)
-(defvar data)
-(defvar prompt)
+(defvar reftex-select-data)
+(defvar reftex-select-prompt)
 (defvar last-data)
 (defvar call-back)
 (defvar help-string)
-(defvar refstyle)
 
 ;; The selection commands
 
@@ -448,15 +446,15 @@
 
 (defun reftex-select-post-command-hook ()
   (let (b e)
-    (setq data (get-text-property (point) :data))
-    (setq last-data (or data last-data))
+    (setq reftex-select-data (get-text-property (point) :data))
+    (setq last-data (or reftex-select-data last-data))
 
-    (when (and data cb-flag
+    (when (and reftex-select-data cb-flag
                (not (equal reftex-last-follow-point (point))))
       (setq reftex-last-follow-point (point))
-      (funcall call-back data reftex-callback-fwd
+      (funcall call-back reftex-select-data reftex-callback-fwd
                (not reftex-revisit-to-follow)))
-    (if data
+    (if reftex-select-data
         (setq b (or (previous-single-property-change
                      (1+ (point)) :data)
                     (point-min))
@@ -470,7 +468,7 @@
             (not (pos-visible-in-window-p e)))
         (recenter '(4)))
     (unless (current-message)
-      (princ prompt))))
+      (princ reftex-select-prompt))))
 
 (defun reftex-select-next (&optional arg)
   "Move to next selectable item."
@@ -531,19 +529,22 @@
   (interactive)
   (setq reftex-last-follow-point -1)
   (setq cb-flag (not cb-flag)))
+
+(defvar reftex-refstyle)                ; from reftex-reference
+
 (defun reftex-select-toggle-varioref ()
   "Toggle the macro used for referencing the label between \\ref and \\vref."
   (interactive)
-  (if (string= refstyle "\\ref")
-      (setq refstyle "\\vref")
-    (setq refstyle "\\ref"))
+  (if (string= reftex-refstyle "\\ref")
+      (setq reftex-refstyle "\\vref")
+    (setq reftex-refstyle "\\ref"))
   (force-mode-line-update))
 (defun reftex-select-toggle-fancyref ()
   "Toggle the macro used for referencing the label between \\ref and \\vref."
   (interactive)
-  (setq refstyle
-        (cond ((string= refstyle "\\ref") "\\fref")
-              ((string= refstyle "\\fref") "\\Fref")
+  (setq reftex-refstyle
+        (cond ((string= reftex-refstyle "\\ref") "\\fref")
+              ((string= reftex-refstyle "\\fref") "\\Fref")
               (t "\\ref")))
   (force-mode-line-update))
 (defun reftex-select-show-insertion-point ()
@@ -560,7 +561,7 @@
 (defun reftex-select-callback ()
   "Show full context in another window."
   (interactive)
-  (if data (funcall call-back data reftex-callback-fwd nil) (ding)))
+  (if reftex-select-data (funcall call-back reftex-select-data reftex-callback-fwd nil) (ding)))
 (defun reftex-select-accept ()
   "Accept the currently selected item."
   (interactive)
@@ -569,8 +570,8 @@
   "Accept the item at the mouse click."
   (interactive "e")
   (mouse-set-point ev)
-  (setq data (get-text-property (point) :data))
-  (setq last-data (or data last-data))
+  (setq reftex-select-data (get-text-property (point) :data))
+  (setq last-data (or reftex-select-data last-data))
   (throw 'myexit 'return))
 (defun reftex-select-read-label ()
   "Use minibuffer to read a label to reference, with completion."
@@ -588,8 +589,8 @@
     (cond
      ((or (null key) (equal key "")))
      (entry
-      (setq data entry)
-      (setq last-data data)
+      (setq reftex-select-data entry)
+      (setq last-data reftex-select-data)
       (throw 'myexit 'return))
      (t (throw 'myexit key)))))
 
@@ -736,5 +737,4 @@
       do (define-key reftex-select-bib-map (car x) (cdr x)))
 
 
-;; arch-tag: 842078ff-0586-4e0b-957e-536e08218464
 ;;; reftex-sel.el ends here
--- a/lisp/textmodes/reftex-toc.el	Sat Nov 06 11:51:11 2010 -0700
+++ b/lisp/textmodes/reftex-toc.el	Sat Nov 06 12:11:38 2010 -0700
@@ -545,7 +545,6 @@
 
 ;; Promotion/Demotion stuff
 
-(defvar delta)
 (defvar pro-or-de)
 (defvar start-pos)
 (defvar start-line)
@@ -601,7 +600,9 @@
                               (reftex-toc-extract-section-number
                                (nth (1- nsec) entries)))))
             ;; Run through the list and prepare the changes.
-            (setq entries (mapcar 'reftex-toc-promote-prepare entries))
+            (setq entries (mapcar
+                           (lambda (e) (reftex-toc-promote-prepare e delta))
+                           entries))
             ;; Ask for permission
             (if (or (not reftex-toc-confirm-promotion)           ; never confirm
                     (and (integerp reftex-toc-confirm-promotion) ; confirm if many
@@ -643,12 +644,11 @@
         (setq mark-active t
               deactivate-mark nil)))))
 
-(defun reftex-toc-promote-prepare (x)
+(defun reftex-toc-promote-prepare (x delta)
   "Look at a toc entry and see if we could pro/demote it.
-Expects the level change DELTA to be dynamically scoped into this function.
 This function prepares everything for the changes, but does not do it.
 The return value is a list with information needed when doing the
-promotion/demotion later."
+promotion/demotion later.  DELTA is the level change."
   (let* ((data (car x))
          (toc-point (cdr x))
          (marker (nth 4 data))
@@ -684,7 +684,6 @@
                     (progn
                       (goto-char toc-point)
                       (error "Cannot %smote special sections" pro-or-de))))
-         ;; Delta is dynamically scoped into here...
          (newlevel (if (>= level 0) (+ delta level) (- level delta)))
          (dummy2 (if (or (and (>= level 0) (= newlevel -1))
                          (and (< level 0)  (= newlevel 0)))
@@ -698,7 +697,7 @@
 
 (defun reftex-toc-promote-action (x)
   "Change the level of a toc entry.
-DELTA and PRO-OR-DE are assumed to be dynamically scoped into this function."
+PRO-OR-DE is assumed to be dynamically scoped into this function."
   (let* ((data (car x))
          (name (nth 1 x))
          (newname (nth 2 x))