Changeset 4079 for trunk/lisp/emacs-lisp/re-builder.el
- Timestamp:
- 05/13/06 11:31:18 (3 years ago)
- Files:
-
- trunk/lisp/emacs-lisp/re-builder.el (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp/emacs-lisp/re-builder.el
r4037 r4079 113 113 (require 'overlay)) 114 114 115 ;; User c ostomizable variables115 ;; User customizable variables 116 116 (defgroup re-builder nil 117 117 "Options for the RE Builder." … … 628 628 i)) 629 629 630 631 630 (defun reb-update-overlays (&optional subexp) 632 631 "Switch to `reb-target-buffer' and mark all matches of `reb-regexp'. 633 632 If SUBEXP is non-nil mark only the corresponding sub-expressions." 634 635 633 (let* ((re (reb-target-binding reb-regexp)) 636 634 (subexps (reb-count-subexps re)) … … 646 644 (< matches reb-auto-match-limit))) 647 645 (if (= 0 (length (match-string 0))) 648 (error "Empty regular expression!")) 649 (let ((i 0)) 646 (error "Empty regular expression!")) 647 (let ((i 0) 648 suffix max-suffix) 650 649 (setq matches (1+ matches)) 651 650 (while (<= i subexps) … … 654 653 (let ((overlay (make-overlay (match-beginning i) 655 654 (match-end i))) 656 (face-name (format "reb-match-%d" i))) 657 (if (not firstmatch) 658 (setq firstmatch (match-data))) 655 ;; When we have exceeded the number of provided faces, 656 ;; cycle thru them where `max-suffix' denotes the maximum 657 ;; suffix for `reb-match-*' that has been defined and 658 ;; `suffix' the suffix calculated for the current match. 659 (face 660 (cond 661 (max-suffix 662 (if (= suffix max-suffix) 663 (setq suffix 1) 664 (setq suffix (1+ suffix))) 665 (intern-soft (format "reb-match-%d" suffix))) 666 ((intern-soft (format "reb-match-%d" i))) 667 ((setq max-suffix (1- i)) 668 (setq suffix 1) 669 ;; `reb-match-1' must exist. 670 'reb-match-1)))) 671 (unless firstmatch (setq firstmatch (match-data))) 659 672 (setq reb-overlays (cons overlay reb-overlays) 660 673 submatches (1+ submatches)) 661 (overlay-put 662 overlay 'face 663 (or (intern-soft face-name) 664 (error "Too many subexpressions - face `%s' not defined" 665 face-name ))) 674 (overlay-put overlay 'face face) 666 675 (overlay-put overlay 'priority i))) 667 676 (setq i (1+ i))))))
