Mercurial > emacs
comparison lisp/isearch.el @ 56352:f0e5e08dd63e
(isearch-query-replace): Pass the regexp-ness and delimited-ness of
the search to query-replace.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 05 Jul 2004 23:28:42 +0000 |
parents | 8d4253b23d7b |
children | 99e8e40ec202 6f6e9fe4658b |
comparison
equal
deleted
inserted
replaced
56351:d073da76f0a5 | 56352:f0e5e08dd63e |
---|---|
1 ;;; isearch.el --- incremental search minor mode | 1 ;;; isearch.el --- incremental search minor mode |
2 | 2 |
3 ;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1999, 2000, 01, 2003, 2004 | 3 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1999, |
4 ;; Free Software Foundation, Inc. | 4 ;; 2000, 2001, 2003, 2004 Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu> | 6 ;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu> |
7 ;; Maintainer: FSF | 7 ;; Maintainer: FSF |
8 ;; Keywords: matching | 8 ;; Keywords: matching |
9 | 9 |
57 ;; keep the behavior. No point in forcing nonincremental search until | 57 ;; keep the behavior. No point in forcing nonincremental search until |
58 ;; the last possible moment. | 58 ;; the last possible moment. |
59 | 59 |
60 ;; TODO | 60 ;; TODO |
61 ;; - Integrate the emacs 19 generalized command history. | 61 ;; - Integrate the emacs 19 generalized command history. |
62 ;; - Think about incorporating query-replace. | |
63 ;; - Hooks and options for failed search. | 62 ;; - Hooks and options for failed search. |
64 | 63 |
65 ;;; Change Log: | 64 ;;; Change Log: |
66 | 65 |
67 ;; Changes before those recorded in ChangeLog: | 66 ;; Changes before those recorded in ChangeLog: |
336 ;; Suggest some alternates... | 335 ;; Suggest some alternates... |
337 (define-key map "\M-c" 'isearch-toggle-case-fold) | 336 (define-key map "\M-c" 'isearch-toggle-case-fold) |
338 (define-key map "\M-r" 'isearch-toggle-regexp) | 337 (define-key map "\M-r" 'isearch-toggle-regexp) |
339 (define-key map "\M-e" 'isearch-edit-string) | 338 (define-key map "\M-e" 'isearch-edit-string) |
340 | 339 |
341 (define-key map (kbd "M-%") 'isearch-query-replace) | 340 (define-key map [?\M-%] 'isearch-query-replace) |
342 (define-key map (kbd "C-M-%") 'isearch-query-replace-regexp) | 341 (define-key map [?\C-\M-%] 'isearch-query-replace-regexp) |
343 | 342 |
344 map) | 343 map) |
345 "Keymap for `isearch-mode'.") | 344 "Keymap for `isearch-mode'.") |
346 | 345 |
347 (defvar minibuffer-local-isearch-map | 346 (defvar minibuffer-local-isearch-map |
1060 (isearch-update)) | 1059 (isearch-update)) |
1061 | 1060 |
1062 (defun isearch-query-replace () | 1061 (defun isearch-query-replace () |
1063 "Start query-replace with string to replace from last search string." | 1062 "Start query-replace with string to replace from last search string." |
1064 (interactive) | 1063 (interactive) |
1065 (let ((query-replace-interactive t) | 1064 (barf-if-buffer-read-only) |
1066 (case-fold-search isearch-case-fold-search)) | 1065 (let ((case-fold-search isearch-case-fold-search)) |
1067 ;; Put search string into the right ring | |
1068 (setq isearch-regexp nil) | |
1069 (isearch-done) | 1066 (isearch-done) |
1070 (isearch-clean-overlays) | 1067 (isearch-clean-overlays) |
1071 (and isearch-forward isearch-other-end (goto-char isearch-other-end)) | 1068 (and isearch-forward isearch-other-end (goto-char isearch-other-end)) |
1072 (call-interactively 'query-replace))) | 1069 (perform-replace |
1070 isearch-string | |
1071 (query-replace-read-to isearch-string "Query replace" isearch-regexp) | |
1072 t isearch-regexp isearch-word))) | |
1073 | 1073 |
1074 (defun isearch-query-replace-regexp () | 1074 (defun isearch-query-replace-regexp () |
1075 "Start query-replace-regexp with string to replace from last search string." | 1075 "Start query-replace-regexp with string to replace from last search string." |
1076 (interactive) | 1076 (interactive) |
1077 (let ((query-replace-interactive t) | 1077 (let ((query-replace-interactive t) |
2378 (setq isearch-string search | 2378 (setq isearch-string search |
2379 isearch-message message | 2379 isearch-message message |
2380 isearch-case-fold-search case-fold) | 2380 isearch-case-fold-search case-fold) |
2381 (isearch-search)) | 2381 (isearch-search)) |
2382 | 2382 |
2383 ;;; arch-tag: 74850515-f7d8-43a6-8a2c-ca90a4c1e675 | 2383 ;; arch-tag: 74850515-f7d8-43a6-8a2c-ca90a4c1e675 |
2384 ;;; isearch.el ends here | 2384 ;;; isearch.el ends here |