Mercurial > hg > xemacs-beta
comparison lisp/prim/isearch-mode.el @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | 8d2a9b52c682 |
children | cf808b4c4290 |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 ;; General Public License for more details. | 18 ;; General Public License for more details. |
19 | 19 |
20 ;; You should have received a copy of the GNU General Public License | 20 ;; You should have received a copy of the GNU General Public License |
21 ;; along with XEmacs; see the file COPYING. If not, write to the | 21 ;; along with XEmacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 22 ;; Free Software Foundation, 59 Temple Place - Suite 330, |
23 ;; Boston, MA 02111-1307, USA. | 23 ;; Boston, MA 02111-1307, USA. |
24 | 24 |
25 ;;; Synched up with: Not synched with FSF. | 25 ;;; Synched up with: Not synched with FSF. |
26 | 26 |
27 ;;;==================================================================== | 27 ;;;==================================================================== |
192 (define-key map "\C-j" 'isearch-printing-char) | 192 (define-key map "\C-j" 'isearch-printing-char) |
193 (define-key map "\t" 'isearch-printing-char) | 193 (define-key map "\t" 'isearch-printing-char) |
194 | 194 |
195 (define-key map "\C-w" 'isearch-yank-word) | 195 (define-key map "\C-w" 'isearch-yank-word) |
196 (define-key map "\C-y" 'isearch-yank-line) | 196 (define-key map "\C-y" 'isearch-yank-line) |
197 (define-key map "\M-y" 'isearch-yank-kill) | |
198 | 197 |
199 ;; Define keys for regexp chars * ? | | 198 ;; Define keys for regexp chars * ? | |
200 (define-key map "*" 'isearch-*-char) | 199 (define-key map "*" 'isearch-*-char) |
201 (define-key map "?" 'isearch-*-char) | 200 (define-key map "?" 'isearch-*-char) |
202 (define-key map "|" 'isearch-|-char) | 201 (define-key map "|" 'isearch-|-char) |
350 ;; Non-standard bindings | 349 ;; Non-standard bindings |
351 ;; Type \\[isearch-toggle-regexp] to toggle regular expression with normal searching. | 350 ;; Type \\[isearch-toggle-regexp] to toggle regular expression with normal searching. |
352 ;; Type \\[isearch-edit-string] to edit the search string in the minibuffer. | 351 ;; Type \\[isearch-edit-string] to edit the search string in the minibuffer. |
353 ;; Terminate editing and return to incremental searching with CR. | 352 ;; Terminate editing and return to incremental searching with CR. |
354 | 353 |
355 (interactive "_P") | 354 (interactive "P") |
356 (isearch-mode t (not (null regexp-p)) nil (not (interactive-p)))) | 355 (isearch-mode t (not (null regexp-p)) nil (not (interactive-p)))) |
357 | 356 |
358 (defun isearch-forward-regexp () | 357 (defun isearch-forward-regexp () |
359 "\ | 358 "\ |
360 Do incremental search forward for regular expression. | 359 Do incremental search forward for regular expression. |
361 Like ordinary incremental search except that your input | 360 Like ordinary incremental search except that your input |
362 is treated as a regexp. See \\[isearch-forward] for more info." | 361 is treated as a regexp. See \\[isearch-forward] for more info." |
363 (interactive "_") | 362 (interactive) |
364 (isearch-mode t t nil (not (interactive-p)))) | 363 (isearch-mode t t nil (not (interactive-p)))) |
365 | 364 |
366 (defun isearch-backward (&optional regexp-p) | 365 (defun isearch-backward (&optional regexp-p) |
367 "\ | 366 "\ |
368 Do incremental search backward. | 367 Do incremental search backward. |
369 With a prefix argument, do an incremental regular expression search instead. | 368 With a prefix argument, do an incremental regular expression search instead. |
370 See \\[isearch-forward] for more information." | 369 See \\[isearch-forward] for more information." |
371 (interactive "_P") | 370 (interactive "P") |
372 (isearch-mode nil (not (null regexp-p)) nil (not (interactive-p)))) | 371 (isearch-mode nil (not (null regexp-p)) nil (not (interactive-p)))) |
373 | 372 |
374 (defun isearch-backward-regexp () | 373 (defun isearch-backward-regexp () |
375 "\ | 374 "\ |
376 Do incremental search backward for regular expression. | 375 Do incremental search backward for regular expression. |
377 Like ordinary incremental search except that your input | 376 Like ordinary incremental search except that your input |
378 is treated as a regexp. See \\[isearch-forward] for more info." | 377 is treated as a regexp. See \\[isearch-forward] for more info." |
379 (interactive "_") | 378 (interactive) |
380 (isearch-mode nil t nil (not (interactive-p)))) | 379 (isearch-mode nil t nil (not (interactive-p)))) |
381 | 380 |
382 ;; This function is way wrong, because you can't scroll the help | 381 |
383 ;; screen; as soon as you press a key, it's gone. I don't know of a | |
384 ;; good way to fix it, though. -hniksic | |
385 (defun isearch-mode-help () | 382 (defun isearch-mode-help () |
386 (interactive "_") | 383 (interactive) |
387 (let ((w (selected-window))) | 384 (describe-function 'isearch-forward) |
388 (describe-function 'isearch-forward) | |
389 (select-window w)) | |
390 (isearch-update)) | 385 (isearch-update)) |
391 | 386 |
392 | 387 |
393 ;;;================================================================== | 388 ;;;================================================================== |
394 ;; isearch-mode only sets up incremental search for the minor mode. | 389 ;; isearch-mode only sets up incremental search for the minor mode. |
831 (isearch-pop-state)) | 826 (isearch-pop-state)) |
832 (isearch-update)) | 827 (isearch-update)) |
833 | 828 |
834 | 829 |
835 (defun isearch-yank (chunk) | 830 (defun isearch-yank (chunk) |
836 ;; Helper for isearch-yank-* functions. CHUNK can be a string or a | 831 ;; Helper for isearch-yank-word and isearch-yank-line |
837 ;; function. | |
838 (let ((word (if (stringp chunk) | 832 (let ((word (if (stringp chunk) |
839 chunk | 833 chunk |
840 (save-excursion | 834 (save-excursion |
841 (and (not isearch-forward) isearch-other-end | 835 (and (not isearch-forward) isearch-other-end |
842 (goto-char isearch-other-end)) | 836 (goto-char isearch-other-end)) |
868 | 862 |
869 (defun isearch-yank-line () | 863 (defun isearch-yank-line () |
870 "Pull rest of line from buffer into search string." | 864 "Pull rest of line from buffer into search string." |
871 (interactive) | 865 (interactive) |
872 (isearch-yank 'end-of-line)) | 866 (isearch-yank 'end-of-line)) |
873 | |
874 (defun isearch-yank-kill () | |
875 "Pull rest of line from kill ring into search string." | |
876 (interactive) | |
877 (isearch-yank (current-kill 0))) | |
878 | 867 |
879 (defun isearch-yank-sexp () | 868 (defun isearch-yank-sexp () |
880 "Pull next expression from buffer into search string." | 869 "Pull next expression from buffer into search string." |
881 (interactive) | 870 (interactive) |
882 (isearch-yank 'forward-sexp)) | 871 (isearch-yank 'forward-sexp)) |
1283 (put 'isearch-exit 'isearch-command t) | 1272 (put 'isearch-exit 'isearch-command t) |
1284 (put 'isearch-printing-char 'isearch-command t) | 1273 (put 'isearch-printing-char 'isearch-command t) |
1285 (put 'isearch-printing-char 'isearch-command t) | 1274 (put 'isearch-printing-char 'isearch-command t) |
1286 (put 'isearch-yank-word 'isearch-command t) | 1275 (put 'isearch-yank-word 'isearch-command t) |
1287 (put 'isearch-yank-line 'isearch-command t) | 1276 (put 'isearch-yank-line 'isearch-command t) |
1288 (put 'isearch-yank-kill 'isearch-command t) | |
1289 (put 'isearch-yank-sexp 'isearch-command t) | 1277 (put 'isearch-yank-sexp 'isearch-command t) |
1290 (put 'isearch-*-char 'isearch-command t) | 1278 (put 'isearch-*-char 'isearch-command t) |
1291 (put 'isearch-*-char 'isearch-command t) | 1279 (put 'isearch-*-char 'isearch-command t) |
1292 (put 'isearch-|-char 'isearch-command t) | 1280 (put 'isearch-|-char 'isearch-command t) |
1293 (put 'isearch-toggle-regexp 'isearch-command t) | 1281 (put 'isearch-toggle-regexp 'isearch-command t) |
1552 ; (funcall function isearch-string)))) | 1540 ; (funcall function isearch-string)))) |
1553 | 1541 |
1554 | 1542 |
1555 (defun isearch-no-upper-case-p (string) | 1543 (defun isearch-no-upper-case-p (string) |
1556 "Return t if there are no upper case chars in string. | 1544 "Return t if there are no upper case chars in string. |
1557 But upper case chars preceded by \\ do not count since they | 1545 But upper case chars preceeded by \\ do not count since they |
1558 have special meaning in a regexp." | 1546 have special meaning in a regexp." |
1559 ;; this incorrectly returns t for "\\\\A" | 1547 ;; this incorrectly returns t for "\\\\A" |
1560 (let ((case-fold-search nil)) | 1548 (let ((case-fold-search nil)) |
1561 (not (string-match "\\(^\\|[^\\]\\)[A-Z]" string)))) | 1549 (not (string-match "\\(^\\|[^\\]\\)[A-Z]" string)))) |