diff options
Diffstat (limited to 'lisp/isearch.el')
| -rw-r--r-- | lisp/isearch.el | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index f9729567169..4d86b37cb8d 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -444,12 +444,15 @@ With a prefix argument, do an incremental regular expression search instead. | |||
| 444 | As you type characters, they add to the search string and are found. | 444 | As you type characters, they add to the search string and are found. |
| 445 | The following non-printing keys are bound in `isearch-mode-map'. | 445 | The following non-printing keys are bound in `isearch-mode-map'. |
| 446 | 446 | ||
| 447 | Type \\[isearch-delete-char] to cancel characters from end of search string. | 447 | Type \\[isearch-delete-char] to cancel last input item from end of search string. |
| 448 | Type \\[isearch-del-char] to cancel last character from end of search string. | ||
| 448 | Type \\[isearch-exit] to exit, leaving point at location found. | 449 | Type \\[isearch-exit] to exit, leaving point at location found. |
| 449 | Type LFD (C-j) to match end of line. | 450 | Type LFD (C-j) to match end of line. |
| 450 | Type \\[isearch-repeat-forward] to search again forward,\ | 451 | Type \\[isearch-repeat-forward] to search again forward,\ |
| 451 | \\[isearch-repeat-backward] to search again backward. | 452 | \\[isearch-repeat-backward] to search again backward. |
| 452 | Type \\[isearch-yank-word-or-char] to yank word from buffer onto end of search\ | 453 | Type \\[isearch-yank-char] to yank character from buffer onto end of search\ |
| 454 | string and search for it. | ||
| 455 | Type \\[isearch-yank-word] to yank word from buffer onto end of search\ | ||
| 453 | string and search for it. | 456 | string and search for it. |
| 454 | Type \\[isearch-yank-line] to yank rest of line onto end of search string\ | 457 | Type \\[isearch-yank-line] to yank rest of line onto end of search string\ |
| 455 | and search for it. | 458 | and search for it. |
| @@ -482,7 +485,7 @@ To use a different input method for searching, type | |||
| 482 | you want to use. | 485 | you want to use. |
| 483 | 486 | ||
| 484 | The above keys, bound in `isearch-mode-map', are often controlled by | 487 | The above keys, bound in `isearch-mode-map', are often controlled by |
| 485 | options; do M-x apropos on search-.* to find them. | 488 | options; do \\[apropos] on search-.* to find them. |
| 486 | Other control and meta characters terminate the search | 489 | Other control and meta characters terminate the search |
| 487 | and are then executed normally (depending on `search-exit-option'). | 490 | and are then executed normally (depending on `search-exit-option'). |
| 488 | Likewise for function keys and mouse button events. | 491 | Likewise for function keys and mouse button events. |
| @@ -785,7 +788,7 @@ The following additional command keys are active while editing. | |||
| 785 | \\[isearch-ring-retreat-edit] to replace the search string with the previous item in the search ring. | 788 | \\[isearch-ring-retreat-edit] to replace the search string with the previous item in the search ring. |
| 786 | \\[isearch-complete-edit] to complete the search string using the search ring. | 789 | \\[isearch-complete-edit] to complete the search string using the search ring. |
| 787 | \\<isearch-mode-map> | 790 | \\<isearch-mode-map> |
| 788 | If first char entered is \\[isearch-yank-word-or-char], then do word search instead." | 791 | If first char entered is \\[isearch-yank-word], then do word search instead." |
| 789 | 792 | ||
| 790 | ;; This code is very hairy for several reasons, explained in the code. | 793 | ;; This code is very hairy for several reasons, explained in the code. |
| 791 | ;; Mainly, isearch-mode must be terminated while editing and then restarted. | 794 | ;; Mainly, isearch-mode must be terminated while editing and then restarted. |
| @@ -992,7 +995,8 @@ Use `isearch-exit' to quit without signaling." | |||
| 992 | 995 | ||
| 993 | (if (equal isearch-string "") | 996 | (if (equal isearch-string "") |
| 994 | (setq isearch-success t) | 997 | (setq isearch-success t) |
| 995 | (if (and isearch-success (equal (match-end 0) (match-beginning 0)) | 998 | (if (and isearch-success |
| 999 | (equal (point) isearch-other-end) | ||
| 996 | (not isearch-just-started)) | 1000 | (not isearch-just-started)) |
| 997 | ;; If repeating a search that found | 1001 | ;; If repeating a search that found |
| 998 | ;; an empty string, ensure we advance. | 1002 | ;; an empty string, ensure we advance. |
| @@ -1049,6 +1053,16 @@ If no previous match was done, just beep." | |||
| 1049 | (isearch-pop-state)) | 1053 | (isearch-pop-state)) |
| 1050 | (isearch-update)) | 1054 | (isearch-update)) |
| 1051 | 1055 | ||
| 1056 | (defun isearch-del-char () | ||
| 1057 | "Discard last character and move point back. | ||
| 1058 | If there is no previous character, just beep." | ||
| 1059 | (interactive) | ||
| 1060 | (if (equal isearch-string "") | ||
| 1061 | (ding) | ||
| 1062 | (setq isearch-string (substring isearch-string 0 -1) | ||
| 1063 | isearch-message (mapconcat 'isearch-text-char-description | ||
| 1064 | isearch-string ""))) | ||
| 1065 | (isearch-search-and-update)) | ||
| 1052 | 1066 | ||
| 1053 | (defun isearch-yank-string (string) | 1067 | (defun isearch-yank-string (string) |
| 1054 | "Pull STRING into search string." | 1068 | "Pull STRING into search string." |
| @@ -1110,7 +1124,7 @@ might return the position of the end of the line." | |||
| 1110 | (buffer-substring-no-properties (point) (funcall jumpform))))) | 1124 | (buffer-substring-no-properties (point) (funcall jumpform))))) |
| 1111 | 1125 | ||
| 1112 | (defun isearch-yank-char () | 1126 | (defun isearch-yank-char () |
| 1113 | "Pull next letter from buffer into search string." | 1127 | "Pull next character from buffer into search string." |
| 1114 | (interactive) | 1128 | (interactive) |
| 1115 | (isearch-yank-internal (lambda () (forward-char 1) (point)))) | 1129 | (isearch-yank-internal (lambda () (forward-char 1) (point)))) |
| 1116 | 1130 | ||
| @@ -1138,9 +1152,8 @@ might return the position of the end of the line." | |||
| 1138 | (defun isearch-search-and-update () | 1152 | (defun isearch-search-and-update () |
| 1139 | ;; Do the search and update the display. | 1153 | ;; Do the search and update the display. |
| 1140 | (when (or isearch-success | 1154 | (when (or isearch-success |
| 1141 | ;; unsuccessful regexp search may become | 1155 | ;; Unsuccessful regexp search may become successful by |
| 1142 | ;; successful by addition of characters which | 1156 | ;; addition of characters which make isearch-string valid |
| 1143 | ;; make isearch-string valid | ||
| 1144 | isearch-regexp | 1157 | isearch-regexp |
| 1145 | ;; If the string was found but was completely invisible, | 1158 | ;; If the string was found but was completely invisible, |
| 1146 | ;; it might now be partly visible, so try again. | 1159 | ;; it might now be partly visible, so try again. |
| @@ -1467,7 +1480,9 @@ Isearch mode." | |||
| 1467 | (command-execute scroll-command) | 1480 | (command-execute scroll-command) |
| 1468 | (let ((ab-bel (isearch-string-out-of-window isearch-point))) | 1481 | (let ((ab-bel (isearch-string-out-of-window isearch-point))) |
| 1469 | (if ab-bel | 1482 | (if ab-bel |
| 1470 | (isearch-back-into-window (eq ab-bel 'above) isearch-point))) | 1483 | (isearch-back-into-window (eq ab-bel 'above) isearch-point) |
| 1484 | (or (eq (point) isearch-point) | ||
| 1485 | (goto-char isearch-point)))) | ||
| 1471 | (isearch-update)) | 1486 | (isearch-update)) |
| 1472 | (search-exit-option | 1487 | (search-exit-option |
| 1473 | (let (window) | 1488 | (let (window) |
| @@ -1746,7 +1761,13 @@ If there is no completion possible, say so and continue searching." | |||
| 1746 | (let ((cursor-in-echo-area ellipsis) | 1761 | (let ((cursor-in-echo-area ellipsis) |
| 1747 | (m (concat | 1762 | (m (concat |
| 1748 | (isearch-message-prefix c-q-hack ellipsis isearch-nonincremental) | 1763 | (isearch-message-prefix c-q-hack ellipsis isearch-nonincremental) |
| 1749 | isearch-message | 1764 | (if (and (not isearch-success) |
| 1765 | (string-match " +$" isearch-message)) | ||
| 1766 | (concat | ||
| 1767 | (substring isearch-message 0 (match-beginning 0)) | ||
| 1768 | (propertize (substring isearch-message (match-beginning 0)) | ||
| 1769 | 'face 'trailing-whitespace)) | ||
| 1770 | isearch-message) | ||
| 1750 | (isearch-message-suffix c-q-hack ellipsis) | 1771 | (isearch-message-suffix c-q-hack ellipsis) |
| 1751 | ))) | 1772 | ))) |
| 1752 | (if c-q-hack | 1773 | (if c-q-hack |
| @@ -1793,7 +1814,11 @@ If there is no completion possible, say so and continue searching." | |||
| 1793 | 1814 | ||
| 1794 | ;; Searching | 1815 | ;; Searching |
| 1795 | 1816 | ||
| 1796 | (defvar isearch-search-fun-function nil "Override `isearch-function-fun'.") | 1817 | (defvar isearch-search-fun-function nil |
| 1818 | "Override `isearch-search-fun'. | ||
| 1819 | This function should return the search function for isearch to use. | ||
| 1820 | It will call this function with three arguments | ||
| 1821 | as if it were `search-forward'.") | ||
| 1797 | 1822 | ||
| 1798 | (defun isearch-search-fun () | 1823 | (defun isearch-search-fun () |
| 1799 | "Return the function to use for the search. | 1824 | "Return the function to use for the search. |