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-parse.el


From: Carsten Dominik
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/reftex-parse.el
Date: Tue, 27 Aug 2002 05:54:41 -0400

Index: emacs/lisp/textmodes/reftex-parse.el
diff -c emacs/lisp/textmodes/reftex-parse.el:1.13 
emacs/lisp/textmodes/reftex-parse.el:1.14
*** emacs/lisp/textmodes/reftex-parse.el:1.13   Thu Jul 25 03:03:41 2002
--- emacs/lisp/textmodes/reftex-parse.el        Tue Aug 27 05:54:41 2002
***************
*** 551,557 ****
    ;; exact (t) or approximate (nil).
  
    (let ((docstruct (symbol-value reftex-docstruct-symbol))
!         (cnt 0) rtn
          found)
      (save-excursion
        (while (not rtn)
--- 551,557 ----
    ;; exact (t) or approximate (nil).
  
    (let ((docstruct (symbol-value reftex-docstruct-symbol))
!         (cnt 0) rtn rtn-if-no-other
          found)
      (save-excursion
        (while (not rtn)
***************
*** 591,598 ****
                            (setq rtn1 (car list) list nil))
                           ((looking-at (reftex-make-regexp-allow-for-ctrl-m
                                         (nth 7 (car list))))
!                           ;; Same title
!                           (setq rtn1 (car list) list nil cnt 2))))
                      (pop list))
                    rtn1))
                 ((match-end 7)
--- 591,598 ----
                            (setq rtn1 (car list) list nil))
                           ((looking-at (reftex-make-regexp-allow-for-ctrl-m
                                         (nth 7 (car list))))
!                           ;; Same title: remember, but keep looking
!                         (setq rtn-if-no-other (car list)))))
                      (pop list))
                    rtn1))
                 ((match-end 7)
***************
*** 637,642 ****
--- 637,646 ----
                           (symbol-value reftex-docstruct-symbol))))
                 (t
                  (error "This should not happen (reftex-where-am-I)"))))))
+     ;; Check if there was only a by-name match for the section.
+     (when (and (not rtn) rtn-if-no-other)
+       (setq rtn rtn-if-no-other
+           cnt 2))
      (cons rtn (eq cnt 1))))
  
  (defun reftex-notice-new (&optional n force)
***************
*** 1002,1008 ****
    ;; Return a string with the current section number.
    ;; When LEVEL is non-nil, increase section numbers on that level.
    (let* ((depth (1- (length reftex-section-numbers))) idx n (string "")
!        (appendix (get 'reftex-section-numbers 'appendix)))
      (when level
        (when (and (> level -1) (not star))
          (aset reftex-section-numbers 
--- 1006,1017 ----
    ;; Return a string with the current section number.
    ;; When LEVEL is non-nil, increase section numbers on that level.
    (let* ((depth (1- (length reftex-section-numbers))) idx n (string "")
!        (appendix (get 'reftex-section-numbers 'appendix))
!        (partspecial (and (not reftex-part-resets-chapter)
!                          (equal level 0))))
!     ;; partspecial means, this is a part statement.
!     ;; Parts do not reset the chapter counter, and the part number is
!     ;; not included in the numbering of other sectioning levels.
      (when level
        (when (and (> level -1) (not star))
          (aset reftex-section-numbers 
***************
*** 1010,1037 ****
        (setq idx (1+ level))
        (when (not star)
        (while (<= idx depth)
!         (aset reftex-section-numbers idx 0)
          (incf idx))))
!     (setq idx 0)
!     (while (<= idx depth)
!       (setq n (aref reftex-section-numbers idx))
!       (setq string (concat string (if (not (string= string "")) "." "")
!                            (int-to-string n)))
!       (incf idx))
!     (save-match-data
!       (if (string-match "\\`\\(address@hidden)+" string)
!           (setq string (replace-match "" nil nil string)))
!       (if (string-match "\\(\\.0\\)+\\'" string)
!           (setq string (replace-match "" nil nil string)))
!       (if (and appendix
!              (string-match "\\`[0-9]+" string))
!         (setq string 
!               (concat
!                (char-to-string
!                 (1- (+ ?A (string-to-int (match-string 0 string)))))
!                (substring string (match-end 0))))))
!     (if star
!         (concat (make-string (1- (length string)) ?\ ) "*")
!       string)))
  
  ;;; reftex-parse.el ends here
--- 1019,1070 ----
        (setq idx (1+ level))
        (when (not star)
        (while (<= idx depth)
!         (if (or (not partspecial)
!                 (not (= idx 1)))
!             (aset reftex-section-numbers idx 0))
          (incf idx))))
!     (if partspecial
!       (setq string (concat "Part " (reftex-roman-number
!                                     (aref reftex-section-numbers 0))))
!       (setq idx (if reftex-part-resets-chapter 0 1))
!       (while (<= idx depth)
!       (setq n (aref reftex-section-numbers idx))
!       (if (not (and partspecial (not (equal string ""))))
!           (setq string (concat string (if (not (string= string "")) "." "")
!                                (int-to-string n))))
!       (incf idx))
!       (save-match-data
!       (if (string-match "\\`\\(address@hidden)+" string)
!           (setq string (replace-match "" nil nil string)))
!       (if (string-match "\\(\\.0\\)+\\'" string)
!           (setq string (replace-match "" nil nil string)))
!       (if (and appendix
!                (string-match "\\`[0-9]+" string))
!           (setq string 
!                 (concat
!                  (char-to-string
!                   (1- (+ ?A (string-to-int (match-string 0 string)))))
!                  (substring string (match-end 0))))))
!       (if star
!         (concat (make-string (1- (length string)) ?\ ) "*")
!       string))))
! 
! (defun reftex-roman-number (n)
!   ;; Return as a string the roman number equal to N.
!   (let ((nrest n)
!       (string "")
!       (list '((1000 . "M") ( 900 . "CM") ( 500 . "D") ( 400 . "CD")
!               ( 100 . "C") (  90 . "XC") (  50 . "L") (  40 . "XL")
!               (  10 . "X") (   9 . "IX") (   5 . "V") (   4 . "IV")
!               (   1 . "I")))
!       listel i s)
!     (while (>= nrest 1)
!       (setq listel (pop list)
!           i (car listel)
!           s (cdr listel))
!       (while (>= nrest i)
!       (setq string (concat string s)
!             nrest (- nrest i))))
!     string))
  
  ;;; reftex-parse.el ends here




reply via email to

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