Mercurial > emacs
comparison lisp/replace.el @ 58741:5ffd11b70941
(occur-1): Specify t for KEEP-PROPS to occur-engine.
(occur-engine): Use `face' prop rather than `font-lock-face'
when specifying use of `match-face'.
(occur-accumulate-lines): Change arg from NO-PROPS to KEEP-PROPS.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 03 Dec 2004 00:19:52 +0000 |
parents | 31d0b9422d7b |
children | 0b183affb969 f2ebccfa87d4 |
comparison
equal
deleted
inserted
replaced
58740:4ea947ec3dac | 58741:5ffd11b70941 |
---|---|
749 #'next-single-property-change) | 749 #'next-single-property-change) |
750 "No more matches") | 750 "No more matches") |
751 ;; In case the *Occur* buffer is visible in a nonselected window. | 751 ;; In case the *Occur* buffer is visible in a nonselected window. |
752 (set-window-point (get-buffer-window (current-buffer)) (point)) | 752 (set-window-point (get-buffer-window (current-buffer)) (point)) |
753 (occur-mode-goto-occurrence))) | 753 (occur-mode-goto-occurrence))) |
754 | |
755 | 754 |
756 (defcustom list-matching-lines-default-context-lines 0 | 755 (defcustom list-matching-lines-default-context-lines 0 |
757 "*Default number of context lines included around `list-matching-lines' matches. | 756 "*Default number of context lines included around `list-matching-lines' matches. |
758 A negative number means to include that many lines before the match. | 757 A negative number means to include that many lines before the match. |
759 A positive number means to include that many lines both before and after." | 758 A positive number means to include that many lines both before and after." |
772 "*Face used by \\[list-matching-lines] to show the names of buffers. | 771 "*Face used by \\[list-matching-lines] to show the names of buffers. |
773 If the value is nil, don't highlight the buffer names specially." | 772 If the value is nil, don't highlight the buffer names specially." |
774 :type 'face | 773 :type 'face |
775 :group 'matching) | 774 :group 'matching) |
776 | 775 |
777 (defun occur-accumulate-lines (count &optional no-props) | 776 (defun occur-accumulate-lines (count &optional keep-props) |
778 (save-excursion | 777 (save-excursion |
779 (let ((forwardp (> count 0)) | 778 (let ((forwardp (> count 0)) |
780 (result nil)) | 779 (result nil)) |
781 (while (not (or (zerop count) | 780 (while (not (or (zerop count) |
782 (if forwardp | 781 (if forwardp |
783 (eobp) | 782 (eobp) |
784 (bobp)))) | 783 (bobp)))) |
785 (setq count (+ count (if forwardp -1 1))) | 784 (setq count (+ count (if forwardp -1 1))) |
786 (push | 785 (push |
787 (funcall (if no-props | 786 (funcall (if keep-props |
788 #'buffer-substring-no-properties | 787 #'buffer-substring |
789 #'buffer-substring) | 788 #'buffer-substring-no-properties) |
790 (line-beginning-position) | 789 (line-beginning-position) |
791 (line-end-position)) | 790 (line-end-position)) |
792 result) | 791 result) |
793 (forward-line (if forwardp 1 -1))) | 792 (forward-line (if forwardp 1 -1))) |
794 (nreverse result)))) | 793 (nreverse result)))) |
919 regexp active-bufs occur-buf | 918 regexp active-bufs occur-buf |
920 (or nlines list-matching-lines-default-context-lines) | 919 (or nlines list-matching-lines-default-context-lines) |
921 (and case-fold-search | 920 (and case-fold-search |
922 (isearch-no-upper-case-p regexp t)) | 921 (isearch-no-upper-case-p regexp t)) |
923 list-matching-lines-buffer-name-face | 922 list-matching-lines-buffer-name-face |
924 nil list-matching-lines-face nil))) | 923 nil list-matching-lines-face t))) |
925 (let* ((bufcount (length active-bufs)) | 924 (let* ((bufcount (length active-bufs)) |
926 (diff (- (length bufs) bufcount))) | 925 (diff (- (length bufs) bufcount))) |
927 (message "Searched %d buffer%s%s; %s match%s for `%s'" | 926 (message "Searched %d buffer%s%s; %s match%s for `%s'" |
928 bufcount (if (= bufcount 1) "" "s") | 927 bufcount (if (= bufcount 1) "" "s") |
929 (if (zerop diff) "" (format " (%d killed)" diff)) | 928 (if (zerop diff) "" (format " (%d killed)" diff)) |
1002 (add-text-properties (match-beginning 0) | 1001 (add-text-properties (match-beginning 0) |
1003 (match-end 0) | 1002 (match-end 0) |
1004 (append | 1003 (append |
1005 `(occur-match t) | 1004 `(occur-match t) |
1006 (when match-face | 1005 (when match-face |
1007 `(font-lock-face ,match-face))) | 1006 ;; Use `face' rather than |
1007 ;; `font-lock-face' here | |
1008 ;; so as to override faces | |
1009 ;; copied from the buffer. | |
1010 `(face ,match-face))) | |
1008 curstring) | 1011 curstring) |
1009 (setq start (match-end 0)))) | 1012 (setq start (match-end 0)))) |
1010 ;; Generate the string to insert for this match | 1013 ;; Generate the string to insert for this match |
1011 (let* ((out-line | 1014 (let* ((out-line |
1012 (concat | 1015 (concat |