diff options
| -rw-r--r-- | lisp/isearch.el | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 44d7bccb8e6..9cb03645aeb 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -361,13 +361,6 @@ A value of nil means highlight all matches." | |||
| 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 | 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 | |||
| 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) |
| @@ -1416,14 +1409,14 @@ might return the position of the end of the line." | |||
| 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)) |
| @@ -1469,26 +1462,7 @@ 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. |
| @@ -1786,10 +1760,10 @@ Isearch mode." | |||
| 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." |
| @@ -1808,6 +1782,14 @@ Obsolete." | |||
| 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) |