Mercurial > emacs
comparison lisp/replace.el @ 90054:f2ebccfa87d4
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-74
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-709
Update from CVS: src/indent.c (Fvertical_motion): Fix last change.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-710
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-715
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-74
Update from CVS
| author | Miles Bader <miles@gnu.org> |
|---|---|
| date | Wed, 08 Dec 2004 05:02:30 +0000 |
| parents | cce1c0ee76ee 5ffd11b70941 |
| children | fb79180b618d |
comparison
equal
deleted
inserted
replaced
| 90053:fff5f1a61d92 | 90054:f2ebccfa87d4 |
|---|---|
| 90 (query-replace-descr lastfrom) | 90 (query-replace-descr lastfrom) |
| 91 (query-replace-descr lastto)) | 91 (query-replace-descr lastto)) |
| 92 (format "%s: " string)) | 92 (format "%s: " string)) |
| 93 nil nil nil | 93 nil nil nil |
| 94 query-replace-from-history-variable | 94 query-replace-from-history-variable |
| 95 nil t)))) | 95 nil t t)))) |
| 96 (if (and (zerop (length from)) lastto lastfrom) | 96 (if (and (zerop (length from)) lastto lastfrom) |
| 97 (cons lastfrom | 97 (cons lastfrom |
| 98 (query-replace-compile-replacement lastto regexp-flag)) | 98 (query-replace-compile-replacement lastto regexp-flag)) |
| 99 ;; Warn if user types \n or \t, but don't reject the input. | 99 ;; Warn if user types \n or \t, but don't reject the input. |
| 100 (and regexp-flag | 100 (and regexp-flag |
| 154 (query-replace-compile-replacement | 154 (query-replace-compile-replacement |
| 155 (save-excursion | 155 (save-excursion |
| 156 (read-from-minibuffer | 156 (read-from-minibuffer |
| 157 (format "%s %s with: " string (query-replace-descr from)) | 157 (format "%s %s with: " string (query-replace-descr from)) |
| 158 nil nil nil | 158 nil nil nil |
| 159 query-replace-to-history-variable from t)) | 159 query-replace-to-history-variable from t t)) |
| 160 regexp-flag)) | 160 regexp-flag)) |
| 161 | 161 |
| 162 (defun query-replace-read-args (string regexp-flag &optional noerror) | 162 (defun query-replace-read-args (string regexp-flag &optional noerror) |
| 163 (unless noerror | 163 (unless noerror |
| 164 (barf-if-buffer-read-only)) | 164 (barf-if-buffer-read-only)) |
| 732 | 732 |
| 733 (defun occur-next-error (&optional argp reset) | 733 (defun occur-next-error (&optional argp reset) |
| 734 "Move to the Nth (default 1) next match in an Occur mode buffer. | 734 "Move to the Nth (default 1) next match in an Occur mode buffer. |
| 735 Compatibility function for \\[next-error] invocations." | 735 Compatibility function for \\[next-error] invocations." |
| 736 (interactive "p") | 736 (interactive "p") |
| 737 (when reset | 737 ;; we need to run occur-find-match from within the Occur buffer |
| 738 (occur-find-match 0 #'next-single-property-change "No first match")) | 738 (with-current-buffer |
| 739 (occur-find-match | 739 (if (next-error-buffer-p (current-buffer)) |
| 740 (prefix-numeric-value argp) | 740 (current-buffer) |
| 741 (if (> 0 (prefix-numeric-value argp)) | 741 (next-error-find-buffer nil nil (lambda() (eq major-mode 'occur-mode)))) |
| 742 #'previous-single-property-change | 742 |
| 743 #'next-single-property-change) | 743 (when reset |
| 744 "No more matches") | 744 (goto-char (point-min))) |
| 745 ;; In case the *Occur* buffer is visible in a nonselected window. | 745 (occur-find-match |
| 746 (set-window-point (get-buffer-window (current-buffer)) (point)) | 746 (abs (prefix-numeric-value argp)) |
| 747 (occur-mode-goto-occurrence)) | 747 (if (> 0 (prefix-numeric-value argp)) |
| 748 | 748 #'previous-single-property-change |
| 749 #'next-single-property-change) | |
| 750 "No more matches") | |
| 751 ;; In case the *Occur* buffer is visible in a nonselected window. | |
| 752 (set-window-point (get-buffer-window (current-buffer)) (point)) | |
| 753 (occur-mode-goto-occurrence))) | |
| 749 | 754 |
| 750 (defcustom list-matching-lines-default-context-lines 0 | 755 (defcustom list-matching-lines-default-context-lines 0 |
| 751 "*Default number of context lines included around `list-matching-lines' matches. | 756 "*Default number of context lines included around `list-matching-lines' matches. |
| 752 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. |
| 753 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." |
| 766 "*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. |
| 767 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." |
| 768 :type 'face | 773 :type 'face |
| 769 :group 'matching) | 774 :group 'matching) |
| 770 | 775 |
| 771 (defun occur-accumulate-lines (count &optional no-props) | 776 (defun occur-accumulate-lines (count &optional keep-props) |
| 772 (save-excursion | 777 (save-excursion |
| 773 (let ((forwardp (> count 0)) | 778 (let ((forwardp (> count 0)) |
| 774 (result nil)) | 779 (result nil)) |
| 775 (while (not (or (zerop count) | 780 (while (not (or (zerop count) |
| 776 (if forwardp | 781 (if forwardp |
| 777 (eobp) | 782 (eobp) |
| 778 (bobp)))) | 783 (bobp)))) |
| 779 (setq count (+ count (if forwardp -1 1))) | 784 (setq count (+ count (if forwardp -1 1))) |
| 780 (push | 785 (push |
| 781 (funcall (if no-props | 786 (funcall (if keep-props |
| 782 #'buffer-substring-no-properties | 787 #'buffer-substring |
| 783 #'buffer-substring) | 788 #'buffer-substring-no-properties) |
| 784 (line-beginning-position) | 789 (line-beginning-position) |
| 785 (line-end-position)) | 790 (line-end-position)) |
| 786 result) | 791 result) |
| 787 (forward-line (if forwardp 1 -1))) | 792 (forward-line (if forwardp 1 -1))) |
| 788 (nreverse result)))) | 793 (nreverse result)))) |
| 913 regexp active-bufs occur-buf | 918 regexp active-bufs occur-buf |
| 914 (or nlines list-matching-lines-default-context-lines) | 919 (or nlines list-matching-lines-default-context-lines) |
| 915 (and case-fold-search | 920 (and case-fold-search |
| 916 (isearch-no-upper-case-p regexp t)) | 921 (isearch-no-upper-case-p regexp t)) |
| 917 list-matching-lines-buffer-name-face | 922 list-matching-lines-buffer-name-face |
| 918 nil list-matching-lines-face nil))) | 923 nil list-matching-lines-face t))) |
| 919 (let* ((bufcount (length active-bufs)) | 924 (let* ((bufcount (length active-bufs)) |
| 920 (diff (- (length bufs) bufcount))) | 925 (diff (- (length bufs) bufcount))) |
| 921 (message "Searched %d buffer%s%s; %s match%s for `%s'" | 926 (message "Searched %d buffer%s%s; %s match%s for `%s'" |
| 922 bufcount (if (= bufcount 1) "" "s") | 927 bufcount (if (= bufcount 1) "" "s") |
| 923 (if (zerop diff) "" (format " (%d killed)" diff)) | 928 (if (zerop diff) "" (format " (%d killed)" diff)) |
| 996 (add-text-properties (match-beginning 0) | 1001 (add-text-properties (match-beginning 0) |
| 997 (match-end 0) | 1002 (match-end 0) |
| 998 (append | 1003 (append |
| 999 `(occur-match t) | 1004 `(occur-match t) |
| 1000 (when match-face | 1005 (when match-face |
| 1001 `(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))) | |
| 1002 curstring) | 1011 curstring) |
| 1003 (setq start (match-end 0)))) | 1012 (setq start (match-end 0)))) |
| 1004 ;; Generate the string to insert for this match | 1013 ;; Generate the string to insert for this match |
| 1005 (let* ((out-line | 1014 (let* ((out-line |
| 1006 (concat | 1015 (concat |
