Mercurial > emacs
comparison lisp/isearch.el @ 87212:80f24a97ade8
(search-upper-case): Doc fix.
(isearch-mode-map): Bind `M-s o' to isearch-occur.
(isearch-query-replace): Doc fix. Let-bind search-upper-case to nil.
(isearch-query-replace-regexp): Doc fix.
(isearch-occur): New function.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Sun, 09 Dec 2007 23:47:30 +0000 |
parents | f194d32fb97d |
children | 107ccd98fa12 2fcaae6177a5 |
comparison
equal
deleted
inserted
replaced
87211:c2b1300a87e5 | 87212:80f24a97ade8 |
---|---|
94 (defcustom search-upper-case 'not-yanks | 94 (defcustom search-upper-case 'not-yanks |
95 "*If non-nil, upper case chars disable case fold searching. | 95 "*If non-nil, upper case chars disable case fold searching. |
96 That is, upper and lower case chars must match exactly. | 96 That is, upper and lower case chars must match exactly. |
97 This applies no matter where the chars come from, but does not | 97 This applies no matter where the chars come from, but does not |
98 apply to chars in regexps that are prefixed with `\\'. | 98 apply to chars in regexps that are prefixed with `\\'. |
99 If this value is `not-yanks', yanked text is always downcased." | 99 If this value is `not-yanks', text yanked into the search string |
100 in Isearch mode is always downcased." | |
100 :type '(choice (const :tag "off" nil) | 101 :type '(choice (const :tag "off" nil) |
101 (const not-yanks) | 102 (const not-yanks) |
102 (other :tag "on" t)) | 103 (other :tag "on" t)) |
103 :group 'isearch) | 104 :group 'isearch) |
104 | 105 |
409 (define-key map "\M-r" 'isearch-toggle-regexp) | 410 (define-key map "\M-r" 'isearch-toggle-regexp) |
410 (define-key map "\M-e" 'isearch-edit-string) | 411 (define-key map "\M-e" 'isearch-edit-string) |
411 | 412 |
412 (define-key map [?\M-%] 'isearch-query-replace) | 413 (define-key map [?\M-%] 'isearch-query-replace) |
413 (define-key map [?\C-\M-%] 'isearch-query-replace-regexp) | 414 (define-key map [?\C-\M-%] 'isearch-query-replace-regexp) |
415 (define-key map "\M-so" 'isearch-occur) | |
414 | 416 |
415 map) | 417 map) |
416 "Keymap for `isearch-mode'.") | 418 "Keymap for `isearch-mode'.") |
417 | 419 |
418 (defvar minibuffer-local-isearch-map | 420 (defvar minibuffer-local-isearch-map |
1228 (setq isearch-success t isearch-adjusted t) | 1230 (setq isearch-success t isearch-adjusted t) |
1229 (sit-for 1) | 1231 (sit-for 1) |
1230 (isearch-update)) | 1232 (isearch-update)) |
1231 | 1233 |
1232 (defun isearch-query-replace (&optional regexp-flag) | 1234 (defun isearch-query-replace (&optional regexp-flag) |
1233 "Start query-replace with string to replace from last search string." | 1235 "Start `query-replace' with string to replace from last search string." |
1234 (interactive) | 1236 (interactive) |
1235 (barf-if-buffer-read-only) | 1237 (barf-if-buffer-read-only) |
1236 (if regexp-flag (setq isearch-regexp t)) | 1238 (if regexp-flag (setq isearch-regexp t)) |
1237 (let ((case-fold-search isearch-case-fold-search)) | 1239 (let ((case-fold-search isearch-case-fold-search) |
1240 ;; set `search-upper-case' to nil to not call | |
1241 ;; `isearch-no-upper-case-p' in `perform-replace' | |
1242 (search-upper-case nil)) | |
1238 (isearch-done) | 1243 (isearch-done) |
1239 (isearch-clean-overlays) | 1244 (isearch-clean-overlays) |
1240 (if (and isearch-other-end | 1245 (if (and isearch-other-end |
1241 (< isearch-other-end (point)) | 1246 (< isearch-other-end (point)) |
1242 (not (and transient-mark-mode mark-active | 1247 (not (and transient-mark-mode mark-active |
1254 t isearch-regexp isearch-word nil nil | 1259 t isearch-regexp isearch-word nil nil |
1255 (if (and transient-mark-mode mark-active) (region-beginning)) | 1260 (if (and transient-mark-mode mark-active) (region-beginning)) |
1256 (if (and transient-mark-mode mark-active) (region-end))))) | 1261 (if (and transient-mark-mode mark-active) (region-end))))) |
1257 | 1262 |
1258 (defun isearch-query-replace-regexp () | 1263 (defun isearch-query-replace-regexp () |
1259 "Start query-replace-regexp with string to replace from last search string." | 1264 "Start `query-replace-regexp' with string to replace from last search string." |
1260 (interactive) | 1265 (interactive) |
1261 (isearch-query-replace t)) | 1266 (isearch-query-replace t)) |
1267 | |
1268 (defun isearch-occur (regexp &optional nlines) | |
1269 "Run `occur' with regexp to search from the current search string. | |
1270 Interactively, REGEXP is the current search regexp or a quoted search | |
1271 string. NLINES has the same meaning as in `occur'." | |
1272 (interactive | |
1273 (list | |
1274 (if isearch-regexp isearch-string (regexp-quote isearch-string)) | |
1275 (if current-prefix-arg (prefix-numeric-value current-prefix-arg)))) | |
1276 (let ((case-fold-search isearch-case-fold-search) | |
1277 ;; set `search-upper-case' to nil to not call | |
1278 ;; `isearch-no-upper-case-p' in `occur-1' | |
1279 (search-upper-case nil)) | |
1280 (occur regexp nlines))) | |
1262 | 1281 |
1263 | 1282 |
1264 (defun isearch-delete-char () | 1283 (defun isearch-delete-char () |
1265 "Discard last input item and move point back. | 1284 "Discard last input item and move point back. |
1266 If no previous match was done, just beep." | 1285 If no previous match was done, just beep." |