emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/textmodes/reftex-index.el


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/reftex-index.el
Date: Tue, 04 Feb 2003 08:30:48 -0500

Index: emacs/lisp/textmodes/reftex-index.el
diff -c emacs/lisp/textmodes/reftex-index.el:1.16 
emacs/lisp/textmodes/reftex-index.el:1.17
*** emacs/lisp/textmodes/reftex-index.el:1.16   Tue Aug 27 05:54:41 2002
--- emacs/lisp/textmodes/reftex-index.el        Tue Feb  4 08:30:45 2003
***************
*** 51,63 ****
         (active (if (boundp 'zmacs-regions)
                     (and zmacs-regions (region-exists-p))  ; XEmacs
                   (and transient-mark-mode mark-active)))  ; Emacs
!        (beg (if active 
                  (region-beginning)
!               (save-excursion 
                  (skip-syntax-backward "w\\") (point))))
         (end (if active
                  (region-end)
!               (save-excursion 
                  (skip-syntax-forward "w\\") (point))))
         (sel (buffer-substring beg end))
         (mathp (condition-case nil (texmathp) (error nil)))
--- 51,63 ----
         (active (if (boundp 'zmacs-regions)
                     (and zmacs-regions (region-exists-p))  ; XEmacs
                   (and transient-mark-mode mark-active)))  ; Emacs
!        (beg (if active
                  (region-beginning)
!               (save-excursion
                  (skip-syntax-backward "w\\") (point))))
         (end (if active
                  (region-end)
!               (save-excursion
                  (skip-syntax-forward "w\\") (point))))
         (sel (buffer-substring beg end))
         (mathp (condition-case nil (texmathp) (error nil)))
***************
*** 88,94 ****
        ;; Delete what is in the buffer and make the index entry
        (delete-region beg end)
        (reftex-index def-char full-entry def-tag sel)))))
!   
  (defun reftex-index (&optional char key tag sel no-insert)
    "Query for an index macro and insert it along with its argments.
  The index macros available are those defined in `reftex-index-macro' or
--- 88,94 ----
        ;; Delete what is in the buffer and make the index entry
        (delete-region beg end)
        (reftex-index def-char full-entry def-tag sel)))))
! 
  (defun reftex-index (&optional char key tag sel no-insert)
    "Query for an index macro and insert it along with its argments.
  The index macros available are those defined in `reftex-index-macro' or
***************
*** 164,170 ****
    ;; OPT-ARGS is a list of optional argument indices, as given by
    ;; `reftex-parse-args'.
    (let* ((opt (and (integerp itag) (member itag opt-args)))
!        (index-tags (cdr (assq 'index-tags 
                                (symbol-value reftex-docstruct-symbol))))
         (default (reftex-default-index))
         (prompt (concat "Index tag"
--- 164,170 ----
    ;; OPT-ARGS is a list of optional argument indices, as given by
    ;; `reftex-parse-args'.
    (let* ((opt (and (integerp itag) (member itag opt-args)))
!        (index-tags (cdr (assq 'index-tags
                                (symbol-value reftex-docstruct-symbol))))
         (default (reftex-default-index))
         (prompt (concat "Index tag"
***************
*** 178,194 ****
  (defun reftex-index-select-tag ()
    ;; Have the user select an index tag.
    ;; FIXME: should we cache tag-alist, prompt and help?
!   (let* ((index-tags (cdr (assoc 'index-tags 
                                 (symbol-value reftex-docstruct-symbol))))
         (default (reftex-default-index)))
!     (cond 
       ((null index-tags)
        (error "No index tags available"))
  
       ((= (length index-tags) 1)
        ;; Just one index, use it
        (car index-tags))
!         
       ((> (length index-tags) 1)
        ;; Several indices, ask.
        (let* ((tags (copy-sequence index-tags))
--- 178,194 ----
  (defun reftex-index-select-tag ()
    ;; Have the user select an index tag.
    ;; FIXME: should we cache tag-alist, prompt and help?
!   (let* ((index-tags (cdr (assoc 'index-tags
                                 (symbol-value reftex-docstruct-symbol))))
         (default (reftex-default-index)))
!     (cond
       ((null index-tags)
        (error "No index tags available"))
  
       ((= (length index-tags) 1)
        ;; Just one index, use it
        (car index-tags))
! 
       ((> (length index-tags) 1)
        ;; Several indices, ask.
        (let* ((tags (copy-sequence index-tags))
***************
*** 209,220 ****
              (unless (assq (aref tag i) tag-alist)
                (push (list (aref tag i)
                            tag
!                           (concat (substring tag 0 i) 
                                    "[" (substring tag i (incf i)) "]"
                                    (substring tag i)))
                      tag-alist)
                (throw 'exit t)))
!           (push (list (+ ?0 (incf cnt)) tag 
                        (concat "[" (int-to-string cnt) "]:" tag))
                  tag-alist)))
        (setq tag-alist (nreverse tag-alist))
--- 209,220 ----
              (unless (assq (aref tag i) tag-alist)
                (push (list (aref tag i)
                            tag
!                           (concat (substring tag 0 i)
                                    "[" (substring tag i (incf i)) "]"
                                    (substring tag i)))
                      tag-alist)
                (throw 'exit t)))
!           (push (list (+ ?0 (incf cnt)) tag
                        (concat "[" (int-to-string cnt) "]:" tag))
                  tag-alist)))
        (setq tag-alist (nreverse tag-alist))
***************
*** 229,235 ****
                      (if default
                          (format "[^M]  %s (the default)\n" default)
                        "")
!                     (mapconcat (lambda(x) 
                                   (apply 'format "[%c]   %s" x))
                                 tag-alist "\n")))
        ;; Query the user for an index-tag
--- 229,235 ----
                      (if default
                          (format "[^M]  %s (the default)\n" default)
                        "")
!                     (mapconcat (lambda(x)
                                   (apply 'format "[%c]   %s" x))
                                 tag-alist "\n")))
        ;; Query the user for an index-tag
***************
*** 258,264 ****
      key))
  
  (defun reftex-index-update-taglist (newtag)
!   ;; add NEWTAG to the list of available index tags. 
    (let ((cell (assoc 'index-tags (symbol-value reftex-docstruct-symbol))))
      (and newtag (cdr cell) (not (member newtag (cdr cell)))
         (push newtag (cdr cell)))))
--- 258,264 ----
      key))
  
  (defun reftex-index-update-taglist (newtag)
!   ;; add NEWTAG to the list of available index tags.
    (let ((cell (assoc 'index-tags (symbol-value reftex-docstruct-symbol))))
      (and newtag (cdr cell) (not (member newtag (cdr cell)))
         (push newtag (cdr cell)))))
***************
*** 339,345 ****
    ;; Note:  This function just looks for the nearest match of the
    ;; context string and may fail if the entry moved and an identical
    ;; entry is close to the old position.  Frequent rescans make this
!   ;; safer. 
    (let* ((file (nth 3 data))
         (literal (nth 2 data))
         (pos (nth 4 data))
--- 339,345 ----
    ;; Note:  This function just looks for the nearest match of the
    ;; context string and may fail if the entry moved and an identical
    ;; entry is close to the old position.  Frequent rescans make this
!   ;; safer.
    (let* ((file (nth 3 data))
         (literal (nth 2 data))
         (pos (nth 4 data))
***************
*** 387,393 ****
         (calling-file (buffer-file-name))
         (restriction
          (or overriding-restriction
!             (and (interactive-p) 
                   (reftex-get-restriction current-prefix-arg docstruct))))
         (locations
          ;; See if we are on an index macro as initial position
--- 387,393 ----
         (calling-file (buffer-file-name))
         (restriction
          (or overriding-restriction
!             (and (interactive-p)
                   (reftex-get-restriction current-prefix-arg docstruct))))
         (locations
          ;; See if we are on an index macro as initial position
***************
*** 396,402 ****
                     (macro (car what-macro))
                     (here-I-am (when (member macro reftex-macros-with-index)
                                  (save-excursion
!                                   (goto-char (+ (cdr what-macro) 
                                                  (length macro)))
                                    (reftex-move-over-touching-args)
                                    (reftex-where-am-I)))))
--- 396,402 ----
                     (macro (car what-macro))
                     (here-I-am (when (member macro reftex-macros-with-index)
                                  (save-excursion
!                                   (goto-char (+ (cdr what-macro)
                                                  (length macro)))
                                    (reftex-move-over-touching-args)
                                    (reftex-where-am-I)))))
***************
*** 407,413 ****
      (setq buffer-name (reftex-make-index-buffer-name index-tag))
  
      ;; Goto the buffer and put it into the correct mode
!                     
      (when (or restriction current-prefix-arg)
         (reftex-kill-buffer buffer-name))
  
--- 407,413 ----
      (setq buffer-name (reftex-make-index-buffer-name index-tag))
  
      ;; Goto the buffer and put it into the correct mode
! 
      (when (or restriction current-prefix-arg)
         (reftex-kill-buffer buffer-name))
  
***************
*** 500,506 ****
        ;; Delete the entry at place
        (and (bolp) (forward-char 1))
        (delete-region (previous-single-property-change (1+ (point)) :data)
!                    (or (next-single-property-change (point) :data) 
                         (point-max))))
  
      ;; Walk through the list and insert all entries
--- 500,506 ----
        ;; Delete the entry at place
        (and (bolp) (forward-char 1))
        (delete-region (previous-single-property-change (1+ (point)) :data)
!                    (or (next-single-property-change (point) :data)
                         (point-max))))
  
      ;; Walk through the list and insert all entries
***************
*** 521,527 ****
        (insert indent (nth 7 cell))
        (when font
        (setq to (point))
!       (put-text-property 
         (- (point) (length (nth 7 cell))) to
         'face index-face)
        (goto-char to))
--- 521,527 ----
        (insert indent (nth 7 cell))
        (when font
        (setq to (point))
!       (put-text-property
         (- (point) (length (nth 7 cell))) to
         'face index-face)
        (goto-char to))
***************
*** 549,555 ****
  (defun reftex-index-insert-new-letter (letter &optional font)
    ;; Start a new section in the index
    (let ((from (point)))
!     (insert "\n" letter letter letter 
            "-----------------------------------------------------------------")
      (when font
        (put-text-property from (point) 'face reftex-index-section-face))
--- 549,555 ----
  (defun reftex-index-insert-new-letter (letter &optional font)
    ;; Start a new section in the index
    (let ((from (point)))
!     (insert "\n" letter letter letter
            "-----------------------------------------------------------------")
      (when font
        (put-text-property from (point) 'face reftex-index-section-face))
***************
*** 626,635 ****
    (interactive "p")
    (setq reftex-callback-fwd t)
    (or (eobp) (forward-char 1))
!   (goto-char (or (next-single-property-change (point) :data) 
                 (point)))
    (unless (get-text-property (point) :data)
!     (goto-char (or (next-single-property-change (point) :data) 
                   (point)))))
  (defun reftex-index-previous (&optional arg)
    "Move to previous selectable item."
--- 626,635 ----
    (interactive "p")
    (setq reftex-callback-fwd t)
    (or (eobp) (forward-char 1))
!   (goto-char (or (next-single-property-change (point) :data)
                 (point)))
    (unless (get-text-property (point) :data)
!     (goto-char (or (next-single-property-change (point) :data)
                   (point)))))
  (defun reftex-index-previous (&optional arg)
    "Move to previous selectable item."
***************
*** 772,778 ****
        (reftex-index-restrict-to-section t)
        (setq reftex-index-restriction-indicator (nth 6 bor)
            reftex-index-restriction-data
!           (list bor 
                  (car (memq (assq 'toc (cdr (memq bor docstruct)))
                             docstruct))))
        (reftex-index-revert))))
--- 772,778 ----
        (reftex-index-restrict-to-section t)
        (setq reftex-index-restriction-indicator (nth 6 bor)
            reftex-index-restriction-data
!           (list bor
                  (car (memq (assq 'toc (cdr (memq bor docstruct)))
                             docstruct))))
        (reftex-index-revert))))
***************
*** 804,810 ****
           show-window show-buffer match)
  
      (unless data (error "Don't know which index entry to visit"))
!     
      (if (eq (car data) 'index)
        (setq match (reftex-index-show-entry data no-revisit)))
  
--- 804,810 ----
           show-window show-buffer match)
  
      (unless data (error "Don't know which index entry to visit"))
! 
      (if (eq (car data) 'index)
        (setq match (reftex-index-show-entry data no-revisit)))
  
***************
*** 875,881 ****
          attr (nth 2 analyze))
      (setf (nth 2 analyze) (if (string= attr bor) "" bor))
      (setq new (apply 'concat analyze))
!     (reftex-index-change-entry 
       new (if (string= (nth 2 analyze) bor)
             "Entry is now START-OF-PAGE-RANGE"
           "START-OF-PAGE-RANGE canceled"))))
--- 875,881 ----
          attr (nth 2 analyze))
      (setf (nth 2 analyze) (if (string= attr bor) "" bor))
      (setq new (apply 'concat analyze))
!     (reftex-index-change-entry
       new (if (string= (nth 2 analyze) bor)
             "Entry is now START-OF-PAGE-RANGE"
           "START-OF-PAGE-RANGE canceled"))))
***************
*** 933,939 ****
          (t (setf (nth n analyze) (concat initial npart))))
      (setq new (apply 'concat analyze))
      ;; Change the entry and insert the changed version into the index.
!     (reftex-index-change-entry 
       new (if (string= npart "")
             (format "Deleted: %s" opart)
           (format "New value is: %s" npart)))))
--- 933,939 ----
          (t (setf (nth n analyze) (concat initial npart))))
      (setq new (apply 'concat analyze))
      ;; Change the entry and insert the changed version into the index.
!     (reftex-index-change-entry
       new (if (string= npart "")
             (format "Deleted: %s" opart)
           (format "New value is: %s" npart)))))
***************
*** 947,960 ****
      (unless data (error "Don't know which index entry to change"))
      (setq old (nth 2 data)
          key (nth 6 data)
!         prefix (completing-read 
!                 "Prefix: " 
!                 (reftex-sublist-nth 
                   docstruct 6
                   (lambda (x)
                     (and (eq (car x) 'index)
                          (string= (nth 1 x) reftex-index-tag))) t)))
!     (unless (string-match 
             (concat (regexp-quote (car reftex-index-special-chars)) "\\'")
             prefix)
        (setq prefix (concat prefix (car reftex-index-special-chars))))
--- 947,960 ----
      (unless data (error "Don't know which index entry to change"))
      (setq old (nth 2 data)
          key (nth 6 data)
!         prefix (completing-read
!                 "Prefix: "
!                 (reftex-sublist-nth
                   docstruct 6
                   (lambda (x)
                     (and (eq (car x) 'index)
                          (string= (nth 1 x) reftex-index-tag))) t)))
!     (unless (string-match
             (concat (regexp-quote (car reftex-index-special-chars)) "\\'")
             prefix)
        (setq prefix (concat prefix (car reftex-index-special-chars))))
***************
*** 994,1000 ****
  (defun reftex-index-change-entry (new &optional message)
    ;; Change the full context string of the index entry at point to
    ;; NEW.  This actually edits the buffer where the entry is defined.
!   
    (let* ((data (get-text-property (point) :data))
         old beg end info)
      (unless data (error "Cannot change entry"))
--- 994,1000 ----
  (defun reftex-index-change-entry (new &optional message)
    ;; Change the full context string of the index entry at point to
    ;; NEW.  This actually edits the buffer where the entry is defined.
! 
    (let* ((data (get-text-property (point) :data))
         old beg end info)
      (unless data (error "Cannot change entry"))
***************
*** 1086,1099 ****
        (if (eq char ?!)
          (error "This <%s> index does not contain entries sorted before the 
letters"
                 reftex-index-tag)
!       (error "This <%s> index does not contain entries starting with `%c'" 
               reftex-index-tag char)))))
  
! (easy-menu-define 
   reftex-index-menu reftex-index-map
   "Menu for Index buffer"
   `("Index"
!    ["Goto section A-Z" 
      (message "To go to a section, just press any of: !%s"
             reftex-index-section-letters) t]
     ["Show Entry" reftex-index-view-entry t]
--- 1086,1099 ----
        (if (eq char ?!)
          (error "This <%s> index does not contain entries sorted before the 
letters"
                 reftex-index-tag)
!       (error "This <%s> index does not contain entries starting with `%c'"
               reftex-index-tag char)))))
  
! (easy-menu-define
   reftex-index-menu reftex-index-map
   "Menu for Index buffer"
   `("Index"
!    ["Goto section A-Z"
      (message "To go to a section, just press any of: !%s"
             reftex-index-section-letters) t]
     ["Show Entry" reftex-index-view-entry t]
***************
*** 1133,1139 ****
      ["Context" reftex-index-toggle-context :style toggle
       :selected reftex-index-include-context]
      "--"
!     ["Follow Mode" reftex-index-toggle-follow :style toggle 
       :selected reftex-index-follow-mode])
     "--"
     ["Help" reftex-index-show-help t]))
--- 1133,1139 ----
      ["Context" reftex-index-toggle-context :style toggle
       :selected reftex-index-include-context]
      "--"
!     ["Follow Mode" reftex-index-toggle-follow :style toggle
       :selected reftex-index-follow-mode])
     "--"
     ["Help" reftex-index-show-help t]))
***************
*** 1185,1191 ****
    (set-marker reftex-index-return-marker (point))
    (reftex-index-selection-or-word arg 'phrase)
    (if (eq major-mode 'reftex-index-phrases-mode)
!       (message 
         (substitute-command-keys
        "Return to LaTeX with \\[reftex-index-phrases-save-and-return]"))))
  
--- 1185,1191 ----
    (set-marker reftex-index-return-marker (point))
    (reftex-index-selection-or-word arg 'phrase)
    (if (eq major-mode 'reftex-index-phrases-mode)
!       (message
         (substitute-command-keys
        "Return to LaTeX with \\[reftex-index-phrases-save-and-return]"))))
  
***************
*** 1214,1220 ****
          (sort (copy-sequence reftex-index-macro-alist)
                (lambda (a b) (equal (car a) default-macro))))
         macro entry key repeat)
!     
      (if master (set (make-local-variable 'TeX-master)
                    (file-name-nondirectory master)))
  
--- 1214,1220 ----
          (sort (copy-sequence reftex-index-macro-alist)
                (lambda (a b) (equal (car a) default-macro))))
         macro entry key repeat)
! 
      (if master (set (make-local-variable 'TeX-master)
                    (file-name-nondirectory master)))
  
***************
*** 1227,1233 ****
        (if (looking-at reftex-index-phrases-comment-regexp)
          (beginning-of-line 2))
        (while (looking-at "^[ \t]*$")
!         (beginning-of-line 2))          
        (cond ((fboundp 'zmacs-activate-region) (zmacs-activate-region))
            ((boundp 'make-active) (setq mark-active t)))
        (if (yes-or-no-p "Delete and rebuilt header ")
--- 1227,1233 ----
        (if (looking-at reftex-index-phrases-comment-regexp)
          (beginning-of-line 2))
        (while (looking-at "^[ \t]*$")
!         (beginning-of-line 2))
        (cond ((fboundp 'zmacs-activate-region) (zmacs-activate-region))
            ((boundp 'make-active) (setq mark-active t)))
        (if (yes-or-no-p "Delete and rebuilt header ")
***************
*** 1303,1309 ****
    (setq major-mode 'reftex-index-phrases-mode
        mode-name "Phrases")
    (use-local-map reftex-index-phrases-map)
!   (set (make-local-variable 'font-lock-defaults) 
         reftex-index-phrases-font-lock-defaults)
    (easy-menu-add reftex-index-phrases-menu reftex-index-phrases-map)
    (set (make-local-variable 'reftex-index-phrases-marker) (make-marker))
--- 1303,1309 ----
    (setq major-mode 'reftex-index-phrases-mode
        mode-name "Phrases")
    (use-local-map reftex-index-phrases-map)
!   (set (make-local-variable 'font-lock-defaults)
         reftex-index-phrases-font-lock-defaults)
    (easy-menu-add reftex-index-phrases-menu reftex-index-phrases-map)
    (set (make-local-variable 'reftex-index-phrases-marker) (make-marker))
***************
*** 1313,1319 ****
  ;; Font Locking stuff
  (let ((ss (if (featurep 'xemacs) 'secondary-selection ''secondary-selection)))
    (setq reftex-index-phrases-font-lock-keywords
!       (list 
         (cons reftex-index-phrases-comment-regexp 'font-lock-comment-face)
         (list reftex-index-phrases-macrodef-regexp
               '(1 font-lock-type-face)
--- 1313,1319 ----
  ;; Font Locking stuff
  (let ((ss (if (featurep 'xemacs) 'secondary-selection ''secondary-selection)))
    (setq reftex-index-phrases-font-lock-keywords
!       (list
         (cons reftex-index-phrases-comment-regexp 'font-lock-comment-face)
         (list reftex-index-phrases-macrodef-regexp
               '(1 font-lock-type-face)
***************
*** 1337,1343 ****
    (setq reftex-index-phrases-font-lock-defaults
        '((reftex-index-phrases-font-lock-keywords)
          nil t nil beginning-of-line))
!   (put 'reftex-index-phrases-mode 'font-lock-defaults 
         reftex-index-phrases-font-lock-defaults) ; XEmacs
    )
  
--- 1337,1343 ----
    (setq reftex-index-phrases-font-lock-defaults
        '((reftex-index-phrases-font-lock-keywords)
          nil t nil beginning-of-line))
!   (put 'reftex-index-phrases-mode 'font-lock-defaults
         reftex-index-phrases-font-lock-defaults) ; XEmacs
    )
  
***************
*** 1400,1409 ****
                   (move-marker reftex-index-phrases-marker
                                (match-beginning 0) (current-buffer))
                   ;; Start the query-replace
!                  (reftex-query-index-phrase-globally 
!                   files phrase macro-fmt 
                    index-key repeat as-words)
!                  (message "%s replaced" 
                            (reftex-number replace-count "occurrence"))))))
          (t (error "Cannot parse this line")))))
  
--- 1400,1409 ----
                   (move-marker reftex-index-phrases-marker
                                (match-beginning 0) (current-buffer))
                   ;; Start the query-replace
!                  (reftex-query-index-phrase-globally
!                   files phrase macro-fmt
                    index-key repeat as-words)
!                  (message "%s replaced"
                            (reftex-number replace-count "occurrence"))))))
          (t (error "Cannot parse this line")))))
  
***************
*** 1446,1452 ****
          (unless buf (error "Master file %s not found" master))
          (set-buffer buf)
          (reftex-access-scan-info)
!         (setq reftex-index-phrases-files 
                (reftex-all-document-files))))
      ;; Parse the files header for macro definitions
      (setq reftex-index-phrases-macro-data nil)
--- 1446,1452 ----
          (unless buf (error "Master file %s not found" master))
          (set-buffer buf)
          (reftex-access-scan-info)
!         (setq reftex-index-phrases-files
                (reftex-all-document-files))))
      ;; Parse the files header for macro definitions
      (setq reftex-index-phrases-macro-data nil)
***************
*** 1461,1467 ****
        ;; Reverse the list, so that the first macro is first
        (if (null reftex-index-phrases-macro-data)
          (error "No valid MACRO DEFINITION line in %s file (make sure to use 
TAB separators)" reftex-index-phrase-file-extension))
!       (setq reftex-index-phrases-macro-data 
            (nreverse reftex-index-phrases-macro-data))
        (goto-char (point-min)))))
  
--- 1461,1467 ----
        ;; Reverse the list, so that the first macro is first
        (if (null reftex-index-phrases-macro-data)
          (error "No valid MACRO DEFINITION line in %s file (make sure to use 
TAB separators)" reftex-index-phrase-file-extension))
!       (setq reftex-index-phrases-macro-data
            (nreverse reftex-index-phrases-macro-data))
        (goto-char (point-min)))))
  
***************
*** 1473,1479 ****
  index the new part without having to go over the unchanged parts again."
    (interactive "r")
    (let ((win-conf (current-window-configuration))
!       (reftex-index-phrases-restrict-file (buffer-file-name)))        
    (save-excursion
      (save-restriction
        (narrow-to-region beg end)
--- 1473,1479 ----
  index the new part without having to go over the unchanged parts again."
    (interactive "r")
    (let ((win-conf (current-window-configuration))
!       (reftex-index-phrases-restrict-file (buffer-file-name)))
    (save-excursion
      (save-restriction
        (narrow-to-region beg end)
***************
*** 1496,1502 ****
        (setq text (reftex-index-simplify-phrase text))
        (goto-char (point-min))
        (if (re-search-forward
!            (concat "^\\(\\S-*\\)\t\\(" (regexp-quote text) 
                     "\\) *[\t\n]") nil t)
            (progn
              (goto-char (match-end 2))
--- 1496,1502 ----
        (setq text (reftex-index-simplify-phrase text))
        (goto-char (point-min))
        (if (re-search-forward
!            (concat "^\\(\\S-*\\)\t\\(" (regexp-quote text)
                     "\\) *[\t\n]") nil t)
            (progn
              (goto-char (match-end 2))
***************
*** 1526,1532 ****
          (let* ((phrase (match-string 3))
                 (case-fold-search reftex-index-phrases-case-fold-search)
                 (re (reftex-index-phrases-find-dup-re phrase t)))
!           (if (save-excursion 
                  (goto-char (point-min))
                  (and (re-search-forward re nil t)
                       (re-search-forward re nil t)))
--- 1526,1532 ----
          (let* ((phrase (match-string 3))
                 (case-fold-search reftex-index-phrases-case-fold-search)
                 (re (reftex-index-phrases-find-dup-re phrase t)))
!           (if (save-excursion
                  (goto-char (point-min))
                  (and (re-search-forward re nil t)
                       (re-search-forward re nil t)))
***************
*** 1619,1625 ****
            (progn
              (princ (format " Superphrases:  Phrase matches the following %s 
in the phrase buffer:\n"
                             (reftex-number ntimes2 "line")))
!             (mapcar (lambda(x) 
                        (princ (format "                Line %4d:  %s\n" (car 
x) (cdr x))))
                      (nreverse superphrases))))))))
  
--- 1619,1625 ----
            (progn
              (princ (format " Superphrases:  Phrase matches the following %s 
in the phrase buffer:\n"
                             (reftex-number ntimes2 "line")))
!             (mapcar (lambda(x)
                        (princ (format "                Line %4d:  %s\n" (car 
x) (cdr x))))
                      (nreverse superphrases))))))))
  
***************
*** 1672,1678 ****
        beg end)
      (goto-char (point-min))
      ;; Find first and last phrase line in buffer
!     (setq beg 
          (and (re-search-forward reftex-index-phrases-phrase-regexp12 nil t)
               (match-beginning 0)))
      (goto-char (point-max))
--- 1672,1678 ----
        beg end)
      (goto-char (point-min))
      ;; Find first and last phrase line in buffer
!     (setq beg
          (and (re-search-forward reftex-index-phrases-phrase-regexp12 nil t)
               (match-beginning 0)))
      (goto-char (point-max))
***************
*** 1699,1713 ****
      (if (string-match reftex-index-phrases-phrase-regexp12 a)
        (progn
          ;; Extract macro char and phrase-or-key for a
!         (setq ca (match-string 1 a) 
!               pa (downcase 
                    (or (and reftex-index-phrases-sort-prefers-entry
                             (match-string 6 a))
                        (match-string 3 a))))
          (if (string-match reftex-index-phrases-phrase-regexp12 b)
              (progn
                ;; Extract macro char and phrase-or-key for b
!               (setq cb (match-string 1 b) 
                      pb (downcase
                          (or (and reftex-index-phrases-sort-prefers-entry
                                   (match-string 6 b))
--- 1699,1713 ----
      (if (string-match reftex-index-phrases-phrase-regexp12 a)
        (progn
          ;; Extract macro char and phrase-or-key for a
!         (setq ca (match-string 1 a)
!               pa (downcase
                    (or (and reftex-index-phrases-sort-prefers-entry
                             (match-string 6 a))
                        (match-string 3 a))))
          (if (string-match reftex-index-phrases-phrase-regexp12 b)
              (progn
                ;; Extract macro char and phrase-or-key for b
!               (setq cb (match-string 1 b)
                      pb (downcase
                          (or (and reftex-index-phrases-sort-prefers-entry
                                   (match-string 6 b))
***************
*** 1715,1721 ****
                (setq c-p (string< ca cb)
                      p-p (string< pa pb))
                ;; Do the right comparison, based on the value of `chars-first'
!               ;; `chars-first' is bound locally in the calling function       
        
                (if chars-first
                    (if (string= ca cb) p-p c-p)
                  (if (string= pa pb) c-p p-p)))))
--- 1715,1721 ----
                (setq c-p (string< ca cb)
                      p-p (string< pa pb))
                ;; Do the right comparison, based on the value of `chars-first'
!               ;; `chars-first' is bound locally in the calling function
                (if chars-first
                    (if (string= ca cb) p-p c-p)
                  (if (string= pa pb) c-p p-p)))))
***************
*** 1726,1732 ****
        (not reftex-index-phrases-sort-in-blocks))))
  
  (defvar reftex-index-phrases-menu)
! (defun reftex-index-make-phrase-regexp (phrase &optional 
                                               as-words allow-newline)
    "Return a regexp matching PHRASE, even if distributed over lines.
  With optional arg AS-WORDS, require word boundary at beginning and end.
--- 1726,1732 ----
        (not reftex-index-phrases-sort-in-blocks))))
  
  (defvar reftex-index-phrases-menu)
! (defun reftex-index-make-phrase-regexp (phrase &optional
                                               as-words allow-newline)
    "Return a regexp matching PHRASE, even if distributed over lines.
  With optional arg AS-WORDS, require word boundary at beginning and end.
***************
*** 1739,1745 ****
                "\\<" "")
            (mapconcat (lambda (w) (regexp-quote (downcase w)))
                       words space-re)
!           (if (and as-words 
                     (string-match "\\w\\'" (nth (1- (length words)) words)))
                "\\>" ""))))
  
--- 1739,1745 ----
                "\\<" "")
            (mapconcat (lambda (w) (regexp-quote (downcase w)))
                       words space-re)
!           (if (and as-words
                     (string-match "\\w\\'" (nth (1- (length words)) words)))
                "\\>" ""))))
  
***************
*** 1762,1769 ****
    (let ((index-keys (split-string (or index-key match)
                                  reftex-index-phrases-logical-and-regexp)))
      (concat
!      (mapconcat (lambda (x) 
!                 (format macro-fmt 
                          (format (if mathp reftex-index-math-format "%s") x)))
                index-keys "")
     (if repeat (reftex-index-simplify-phrase match) ""))))
--- 1762,1769 ----
    (let ((index-keys (split-string (or index-key match)
                                  reftex-index-phrases-logical-and-regexp)))
      (concat
!      (mapconcat (lambda (x)
!                 (format macro-fmt
                          (format (if mathp reftex-index-math-format "%s") x)))
                index-keys "")
     (if repeat (reftex-index-simplify-phrase match) ""))))
***************
*** 1775,1781 ****
      (unless files (error "No files"))
      (unwind-protect
        (progn
!         (switch-to-buffer-other-window (reftex-get-file-buffer-force 
                                          (car files)))
          (catch 'no-more-files
            (while (setq file (pop files))
--- 1775,1781 ----
      (unless files (error "No files"))
      (unwind-protect
        (progn
!         (switch-to-buffer-other-window (reftex-get-file-buffer-force
                                          (car files)))
          (catch 'no-more-files
            (while (setq file (pop files))
***************
*** 1815,1826 ****
  both ends."
    (let* ((re (reftex-index-make-phrase-regexp phrase as-words 'allow-newline))
         (case-fold-search reftex-index-phrases-case-fold-search)
!        (index-keys (split-string 
                      (or index-key phrase)
                      reftex-index-phrases-logical-or-regexp))
         (nkeys (length index-keys))
         (ckey (nth 0 index-keys))
!        (all-yes nil) 
         match rpl char beg end mathp)
      (unwind-protect
        (while (re-search-forward re nil t)
--- 1815,1826 ----
  both ends."
    (let* ((re (reftex-index-make-phrase-regexp phrase as-words 'allow-newline))
         (case-fold-search reftex-index-phrases-case-fold-search)
!        (index-keys (split-string
                      (or index-key phrase)
                      reftex-index-phrases-logical-or-regexp))
         (nkeys (length index-keys))
         (ckey (nth 0 index-keys))
!        (all-yes nil)
         match rpl char beg end mathp)
      (unwind-protect
        (while (re-search-forward re nil t)
***************
*** 1840,1855 ****
                                                             end)))
                (throw 'next-match nil))
            (reftex-highlight 0 (match-beginning 0) (match-end 0))
!           (setq rpl 
                  (save-match-data
                    (reftex-index-make-replace-string
                     macro-fmt (match-string 0) ckey repeat mathp)))
!           (while 
                (not
                 (catch 'loop
                   (message "REPLACE: %s?   (yn!qoe%s?)"
                            rpl
!                           (if (> nkeys 1) 
                                (concat "1-" (int-to-string nkeys))
                              ""))
                   (setq char (if all-yes ?y (read-char-exclusive)))
--- 1840,1855 ----
                                                             end)))
                (throw 'next-match nil))
            (reftex-highlight 0 (match-beginning 0) (match-end 0))
!           (setq rpl
                  (save-match-data
                    (reftex-index-make-replace-string
                     macro-fmt (match-string 0) ckey repeat mathp)))
!           (while
                (not
                 (catch 'loop
                   (message "REPLACE: %s?   (yn!qoe%s?)"
                            rpl
!                           (if (> nkeys 1)
                                (concat "1-" (int-to-string nkeys))
                              ""))
                   (setq char (if all-yes ?y (read-char-exclusive)))
***************
*** 1883,1889 ****
                         ((member char '(?o ?O))
                          ;; Select a differnt macro
                          (let* ((nc (reftex-index-select-phrases-macro 2))
!                                (macro-data 
                                  (cdr (assoc nc 
reftex-index-phrases-macro-data)))
                                 (macro-fmt (car macro-data))
                                 (repeat (nth 1 macro-data)))
--- 1883,1889 ----
                         ((member char '(?o ?O))
                          ;; Select a differnt macro
                          (let* ((nc (reftex-index-select-phrases-macro 2))
!                                (macro-data
                                  (cdr (assoc nc 
reftex-index-phrases-macro-data)))
                                 (macro-fmt (car macro-data))
                                 (repeat (nth 1 macro-data)))
***************
*** 1901,1907 ****
                          ;; Recursive edit
                          (save-match-data
                            (save-excursion
!                             (message 
                               (substitute-command-keys
                                "Recursive edit.  Resume with 
\\[exit-recursive-edit]"))
                              (recursive-edit))))
--- 1901,1907 ----
                          ;; Recursive edit
                          (save-match-data
                            (save-excursion
!                             (message
                               (substitute-command-keys
                                "Recursive edit.  Resume with 
\\[exit-recursive-edit]"))
                              (recursive-edit))))
***************
*** 1948,1954 ****
          (and after-macro
               (member after-macro reftex-macros-with-index))))))
  
!     
  (defun reftex-index-phrases-fixup-line (beg end)
    "Insert newlines before BEG and/or after END to shorten line."
    (let (bol eol space1 space2)
--- 1948,1954 ----
          (and after-macro
               (member after-macro reftex-macros-with-index))))))
  
! 
  (defun reftex-index-phrases-fixup-line (beg end)
    "Insert newlines before BEG and/or after END to shorten line."
    (let (bol eol space1 space2)
***************
*** 2032,2038 ****
        ("\C-i"     . self-insert-command))
        do (define-key reftex-index-phrases-map (car x) (cdr x)))
  
! (easy-menu-define 
   reftex-index-phrases-menu reftex-index-phrases-map
   "Menu for Phrases buffer"
   '("Phrases"
--- 2032,2038 ----
        ("\C-i"     . self-insert-command))
        do (define-key reftex-index-phrases-map (car x) (cdr x)))
  
! (easy-menu-define
   reftex-index-phrases-menu reftex-index-phrases-map
   "Menu for Phrases buffer"
   '("Phrases"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]