Mercurial > emacs
comparison lisp/isearch.el @ 64436:8c591f014cf5
(isearch-mode-map): Remove key bindings for regexp chars * ? } |.
(isearch-fallback): Don't call `isearch-process-search-char'.
(isearch-*-char, isearch-}-char, isearch-|-char): Remove functions.
(isearch-process-search-char): Call `isearch-fallback' for regexp chars * ? } |.
(isearch-return-char): Make obsolete with `make-obsolete' instead
of simply documenting it as obsolete in the docstring.
(isearch-fallback): Refill docstring.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Mon, 18 Jul 2005 14:32:30 +0000 |
parents | d41de3ff06c8 |
children | 1e7ae6f38b3a |
comparison
equal
deleted
inserted
replaced
64435:756d49c05efa | 64436:8c591f014cf5 |
---|---|
358 | 358 |
359 (define-key map "\C-w" 'isearch-yank-word-or-char) | 359 (define-key map "\C-w" 'isearch-yank-word-or-char) |
360 (define-key map "\M-\C-w" 'isearch-del-char) | 360 (define-key map "\M-\C-w" 'isearch-del-char) |
361 (define-key map "\M-\C-y" 'isearch-yank-char) | 361 (define-key map "\M-\C-y" 'isearch-yank-char) |
362 (define-key map "\C-y" 'isearch-yank-line) | 362 (define-key map "\C-y" 'isearch-yank-line) |
363 | |
364 ;; Define keys for regexp chars * ? } |. | |
365 ;; Nothing special for + because it matches at least once. | |
366 (define-key map "*" 'isearch-*-char) | |
367 (define-key map "?" 'isearch-*-char) | |
368 (define-key map "}" 'isearch-}-char) | |
369 (define-key map "|" 'isearch-|-char) | |
370 | 363 |
371 ;; Turned off because I find I expect to get the global definition--rms. | 364 ;; Turned off because I find I expect to get the global definition--rms. |
372 ;; ;; Instead bind C-h to special help command for isearch-mode. | 365 ;; ;; Instead bind C-h to special help command for isearch-mode. |
373 ;; (define-key map "\C-h" 'isearch-mode-help) | 366 ;; (define-key map "\C-h" 'isearch-mode-help) |
374 | 367 |
1414 "Return point to previous successful match to allow regexp liberalization. | 1407 "Return point to previous successful match to allow regexp liberalization. |
1415 \\<isearch-mode-map> | 1408 \\<isearch-mode-map> |
1416 Respects \\[isearch-repeat-forward] and \\[isearch-repeat-backward] by | 1409 Respects \\[isearch-repeat-forward] and \\[isearch-repeat-backward] by |
1417 stopping at `isearch-barrier' as needed. | 1410 stopping at `isearch-barrier' as needed. |
1418 | 1411 |
1419 Do nothing if a backslash is escaping the liberalizing character. If | 1412 Do nothing if a backslash is escaping the liberalizing character. |
1420 WANT-BACKSLASH is non-nil, invert this behavior (for \\} and \\|). | 1413 If WANT-BACKSLASH is non-nil, invert this behavior (for \\} and \\|). |
1421 | 1414 |
1422 Do nothing if regexp has recently been invalid unless optional ALLOW-INVALID | 1415 Do nothing if regexp has recently been invalid unless optional |
1423 non-nil. | 1416 ALLOW-INVALID non-nil. |
1424 | 1417 |
1425 If optional TO-BARRIER non-nil, ignore previous matches and go exactly to the | 1418 If optional TO-BARRIER non-nil, ignore previous matches and go exactly |
1426 barrier." | 1419 to the barrier." |
1427 ;; (eq (not a) (not b)) makes all non-nil values equivalent | 1420 ;; (eq (not a) (not b)) makes all non-nil values equivalent |
1428 (when (and isearch-regexp (eq (not (isearch-backslash isearch-string)) | 1421 (when (and isearch-regexp (eq (not (isearch-backslash isearch-string)) |
1429 (not want-backslash)) | 1422 (not want-backslash)) |
1430 ;; We have to check 2 stack frames because the last might be | 1423 ;; We have to check 2 stack frames because the last might be |
1431 ;; invalid just because of a backslash. | 1424 ;; invalid just because of a backslash. |
1467 (isearch-other-end-state (car previous))) | 1460 (isearch-other-end-state (car previous))) |
1468 isearch-barrier))) | 1461 isearch-barrier))) |
1469 (goto-char (if isearch-forward | 1462 (goto-char (if isearch-forward |
1470 (max last-other-end isearch-barrier) | 1463 (max last-other-end isearch-barrier) |
1471 (min last-other-end isearch-barrier))) | 1464 (min last-other-end isearch-barrier))) |
1472 (setq isearch-adjusted t)))))) | 1465 (setq isearch-adjusted t))))))) |
1473 (isearch-process-search-char last-command-char)) | |
1474 | |
1475 ;; * and ? are special when not preceded by \. | |
1476 (defun isearch-*-char () | |
1477 "Maybe back up to handle * and ? specially in regexps." | |
1478 (interactive) | |
1479 (isearch-fallback nil)) | |
1480 | |
1481 ;; } is special when it is preceded by \. | |
1482 (defun isearch-}-char () | |
1483 "Handle \\} specially in regexps." | |
1484 (interactive) | |
1485 (isearch-fallback t t)) | |
1486 | |
1487 ;; | is special when it is preceded by \. | |
1488 (defun isearch-|-char () | |
1489 "If in regexp search, jump to the barrier unless in a group." | |
1490 (interactive) | |
1491 (isearch-fallback t nil t)) | |
1492 | 1466 |
1493 (defun isearch-unread-key-sequence (keylist) | 1467 (defun isearch-unread-key-sequence (keylist) |
1494 "Unread the given key-sequence KEYLIST. | 1468 "Unread the given key-sequence KEYLIST. |
1495 Scroll-bar or mode-line events are processed appropriately." | 1469 Scroll-bar or mode-line events are processed appropriately." |
1496 (cancel-kbd-macro-events) | 1470 (cancel-kbd-macro-events) |
1784 (<= char ?\377) | 1758 (<= char ?\377) |
1785 (setq char (unibyte-char-to-multibyte char))) | 1759 (setq char (unibyte-char-to-multibyte char))) |
1786 (isearch-process-search-char char)))) | 1760 (isearch-process-search-char char)))) |
1787 | 1761 |
1788 (defun isearch-return-char () | 1762 (defun isearch-return-char () |
1789 "Convert return into newline for incremental search. | 1763 "Convert return into newline for incremental search." |
1790 Obsolete." | |
1791 (interactive) | 1764 (interactive) |
1792 (isearch-process-search-char ?\n)) | 1765 (isearch-process-search-char ?\n)) |
1766 (make-obsolete 'isearch-return-char 'isearch-printing-char) | |
1793 | 1767 |
1794 (defun isearch-printing-char () | 1768 (defun isearch-printing-char () |
1795 "Add this ordinary printing character to the search string and search." | 1769 "Add this ordinary printing character to the search string and search." |
1796 (interactive) | 1770 (interactive) |
1797 (let ((char last-command-char)) | 1771 (let ((char last-command-char)) |
1806 (if current-input-method | 1780 (if current-input-method |
1807 (isearch-process-search-multibyte-characters char) | 1781 (isearch-process-search-multibyte-characters char) |
1808 (isearch-process-search-char char))))) | 1782 (isearch-process-search-char char))))) |
1809 | 1783 |
1810 (defun isearch-process-search-char (char) | 1784 (defun isearch-process-search-char (char) |
1785 ;; * and ? are special in regexps when not preceded by \. | |
1786 ;; } and | are special in regexps when preceded by \. | |
1787 ;; Nothing special for + because it matches at least once. | |
1788 (cond | |
1789 ((memq char '(?* ??)) (isearch-fallback nil)) | |
1790 ((eq char ?\}) (isearch-fallback t t)) | |
1791 ((eq char ?|) (isearch-fallback t nil t))) | |
1792 | |
1811 ;; Append the char to the search string, update the message and re-search. | 1793 ;; Append the char to the search string, update the message and re-search. |
1812 (isearch-process-search-string | 1794 (isearch-process-search-string |
1813 (char-to-string char) | 1795 (char-to-string char) |
1814 (if (>= char ?\200) | 1796 (if (>= char ?\200) |
1815 (char-to-string char) | 1797 (char-to-string char) |