Mercurial > emacs
comparison lisp/replace.el @ 89909:68c22ea6027c
Sync to HEAD
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 16 Apr 2004 12:51:06 +0000 |
parents | 375f2633d815 |
children | 4c90ffeb71c5 |
comparison
equal
deleted
inserted
replaced
89908:ee1402f7b568 | 89909:68c22ea6027c |
---|---|
221 (if (and transient-mark-mode mark-active) | 221 (if (and transient-mark-mode mark-active) |
222 (region-beginning)) | 222 (region-beginning)) |
223 (if (and transient-mark-mode mark-active) | 223 (if (and transient-mark-mode mark-active) |
224 (region-end))))) | 224 (region-end))))) |
225 (perform-replace regexp (cons 'replace-eval-replacement to-expr) | 225 (perform-replace regexp (cons 'replace-eval-replacement to-expr) |
226 t t delimited nil nil start end)) | 226 t 'literal delimited nil nil start end)) |
227 | 227 |
228 (defun map-query-replace-regexp (regexp to-strings &optional n start end) | 228 (defun map-query-replace-regexp (regexp to-strings &optional n start end) |
229 "Replace some matches for REGEXP with various strings, in rotation. | 229 "Replace some matches for REGEXP with various strings, in rotation. |
230 The second argument TO-STRINGS contains the replacement strings, | 230 The second argument TO-STRINGS contains the replacement strings, |
231 separated by spaces. Third arg DELIMITED (prefix arg if interactive), | 231 separated by spaces. Third arg DELIMITED (prefix arg if interactive), |
914 (setq globalcount (+ globalcount matches)) | 914 (setq globalcount (+ globalcount matches)) |
915 (with-current-buffer out-buf | 915 (with-current-buffer out-buf |
916 (goto-char headerpt) | 916 (goto-char headerpt) |
917 (let ((beg (point)) | 917 (let ((beg (point)) |
918 end) | 918 end) |
919 (insert (format "%d lines matching \"%s\" in buffer: %s\n" | 919 (insert (format "%d match%s for \"%s\" in buffer: %s\n" |
920 matches regexp (buffer-name buf))) | 920 matches (if (= matches 1) "" "es") |
921 regexp (buffer-name buf))) | |
921 (setq end (point)) | 922 (setq end (point)) |
922 (add-text-properties beg end | 923 (add-text-properties beg end |
923 (append | 924 (append |
924 (when title-face | 925 (when title-face |
925 `(font-lock-face ,title-face)) | 926 `(font-lock-face ,title-face)) |
1055 (string-equal from-string | 1056 (string-equal from-string |
1056 (downcase from-string))))) | 1057 (downcase from-string))))) |
1057 (case-fold-search (and case-fold-search | 1058 (case-fold-search (and case-fold-search |
1058 (string-equal from-string | 1059 (string-equal from-string |
1059 (downcase from-string)))) | 1060 (downcase from-string)))) |
1060 (literal (not regexp-flag)) | 1061 (literal (or (not regexp-flag) (eq regexp-flag 'literal))) |
1061 (search-function (if regexp-flag 're-search-forward 'search-forward)) | 1062 (search-function (if regexp-flag 're-search-forward 'search-forward)) |
1062 (search-string from-string) | 1063 (search-string from-string) |
1063 (real-match-data nil) ; the match data for the current match | 1064 (real-match-data nil) ; the match data for the current match |
1064 (next-replacement nil) | 1065 (next-replacement nil) |
1065 (keep-going t) | 1066 (keep-going t) |
1326 (overlay-put replace-overlay 'face | 1327 (overlay-put replace-overlay 'face |
1327 (if (facep 'query-replace) | 1328 (if (facep 'query-replace) |
1328 'query-replace 'region)))) | 1329 'query-replace 'region)))) |
1329 (move-overlay replace-overlay start end (current-buffer))))) | 1330 (move-overlay replace-overlay start end (current-buffer))))) |
1330 | 1331 |
1332 ;;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4 | |
1331 ;;; replace.el ends here | 1333 ;;; replace.el ends here |