diff options
| author | Juri Linkov | 2004-04-29 15:28:55 +0000 |
|---|---|---|
| committer | Juri Linkov | 2004-04-29 15:28:55 +0000 |
| commit | 35904fd3554171219c7edda7e82cac3e622b5b75 (patch) | |
| tree | fc40ec02ac3333f55de17bac732e1b556ed19697 | |
| parent | 016b8f71efe187f403913d47890c8e0408472617 (diff) | |
| download | emacs-35904fd3554171219c7edda7e82cac3e622b5b75.tar.gz emacs-35904fd3554171219c7edda7e82cac3e622b5b75.zip | |
(isearch-mode-map): Bind \C-w to isearch-yank-word instead of isearch-yank-word-or-char.
Add new key bindings for isearch-yank-char to \C-f, and isearch-del-char to \C-b.
(isearch-del-char): New fun.
(isearch-forward, isearch-edit-string): Update docstring.
(isearch-yank-char): Doc fix.
(isearch-other-meta-char): Restore point after scrolling.
| -rw-r--r-- | lisp/isearch.el | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 91a2c34870d..76e72bfb632 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -294,7 +294,9 @@ Default value, nil, means edit the string instead." | |||
| 294 | (define-key map " " 'isearch-whitespace-chars) | 294 | (define-key map " " 'isearch-whitespace-chars) |
| 295 | (define-key map [?\S-\ ] 'isearch-whitespace-chars) | 295 | (define-key map [?\S-\ ] 'isearch-whitespace-chars) |
| 296 | 296 | ||
| 297 | (define-key map "\C-w" 'isearch-yank-word-or-char) | 297 | (define-key map "\C-b" 'isearch-del-char) |
| 298 | (define-key map "\C-f" 'isearch-yank-char) | ||
| 299 | (define-key map "\C-w" 'isearch-yank-word) | ||
| 298 | (define-key map "\C-y" 'isearch-yank-line) | 300 | (define-key map "\C-y" 'isearch-yank-line) |
| 299 | 301 | ||
| 300 | ;; Define keys for regexp chars * ? |. | 302 | ;; Define keys for regexp chars * ? |. |
| @@ -448,12 +450,15 @@ With a prefix argument, do an incremental regular expression search instead. | |||
| 448 | As you type characters, they add to the search string and are found. | 450 | As you type characters, they add to the search string and are found. |
| 449 | The following non-printing keys are bound in `isearch-mode-map'. | 451 | The following non-printing keys are bound in `isearch-mode-map'. |
| 450 | 452 | ||
| 451 | Type \\[isearch-delete-char] to cancel characters from end of search string. | 453 | Type \\[isearch-delete-char] to cancel last input item from end of search string. |
| 454 | Type \\[isearch-del-char] to cancel last character from end of search string. | ||
| 452 | Type \\[isearch-exit] to exit, leaving point at location found. | 455 | Type \\[isearch-exit] to exit, leaving point at location found. |
| 453 | Type LFD (C-j) to match end of line. | 456 | Type LFD (C-j) to match end of line. |
| 454 | Type \\[isearch-repeat-forward] to search again forward,\ | 457 | Type \\[isearch-repeat-forward] to search again forward,\ |
| 455 | \\[isearch-repeat-backward] to search again backward. | 458 | \\[isearch-repeat-backward] to search again backward. |
| 456 | Type \\[isearch-yank-word-or-char] to yank word from buffer onto end of search\ | 459 | Type \\[isearch-yank-char] to yank character from buffer onto end of search\ |
| 460 | string and search for it. | ||
| 461 | Type \\[isearch-yank-word] to yank word from buffer onto end of search\ | ||
| 457 | string and search for it. | 462 | string and search for it. |
| 458 | Type \\[isearch-yank-line] to yank rest of line onto end of search string\ | 463 | Type \\[isearch-yank-line] to yank rest of line onto end of search string\ |
| 459 | and search for it. | 464 | and search for it. |
| @@ -486,7 +491,7 @@ To use a different input method for searching, type | |||
| 486 | you want to use. | 491 | you want to use. |
| 487 | 492 | ||
| 488 | The above keys, bound in `isearch-mode-map', are often controlled by | 493 | The above keys, bound in `isearch-mode-map', are often controlled by |
| 489 | options; do M-x apropos on search-.* to find them. | 494 | options; do \\[apropos] on search-.* to find them. |
| 490 | Other control and meta characters terminate the search | 495 | Other control and meta characters terminate the search |
| 491 | and are then executed normally (depending on `search-exit-option'). | 496 | and are then executed normally (depending on `search-exit-option'). |
| 492 | Likewise for function keys and mouse button events. | 497 | Likewise for function keys and mouse button events. |
| @@ -789,7 +794,7 @@ The following additional command keys are active while editing. | |||
| 789 | \\[isearch-ring-retreat-edit] to replace the search string with the previous item in the search ring. | 794 | \\[isearch-ring-retreat-edit] to replace the search string with the previous item in the search ring. |
| 790 | \\[isearch-complete-edit] to complete the search string using the search ring. | 795 | \\[isearch-complete-edit] to complete the search string using the search ring. |
| 791 | \\<isearch-mode-map> | 796 | \\<isearch-mode-map> |
| 792 | If first char entered is \\[isearch-yank-word-or-char], then do word search instead." | 797 | If first char entered is \\[isearch-yank-word], then do word search instead." |
| 793 | 798 | ||
| 794 | ;; This code is very hairy for several reasons, explained in the code. | 799 | ;; This code is very hairy for several reasons, explained in the code. |
| 795 | ;; Mainly, isearch-mode must be terminated while editing and then restarted. | 800 | ;; Mainly, isearch-mode must be terminated while editing and then restarted. |
| @@ -1053,6 +1058,16 @@ If no previous match was done, just beep." | |||
| 1053 | (isearch-pop-state)) | 1058 | (isearch-pop-state)) |
| 1054 | (isearch-update)) | 1059 | (isearch-update)) |
| 1055 | 1060 | ||
| 1061 | (defun isearch-del-char () | ||
| 1062 | "Discard last character and move point back. | ||
| 1063 | If there is no previous character, just beep." | ||
| 1064 | (interactive) | ||
| 1065 | (if (equal isearch-string "") | ||
| 1066 | (ding) | ||
| 1067 | (setq isearch-string (substring isearch-string 0 -1) | ||
| 1068 | isearch-message (mapconcat 'isearch-text-char-description | ||
| 1069 | isearch-string ""))) | ||
| 1070 | (isearch-search-and-update)) | ||
| 1056 | 1071 | ||
| 1057 | (defun isearch-yank-string (string) | 1072 | (defun isearch-yank-string (string) |
| 1058 | "Pull STRING into search string." | 1073 | "Pull STRING into search string." |
| @@ -1114,7 +1129,7 @@ might return the position of the end of the line." | |||
| 1114 | (buffer-substring-no-properties (point) (funcall jumpform))))) | 1129 | (buffer-substring-no-properties (point) (funcall jumpform))))) |
| 1115 | 1130 | ||
| 1116 | (defun isearch-yank-char () | 1131 | (defun isearch-yank-char () |
| 1117 | "Pull next letter from buffer into search string." | 1132 | "Pull next character from buffer into search string." |
| 1118 | (interactive) | 1133 | (interactive) |
| 1119 | (isearch-yank-internal (lambda () (forward-char 1) (point)))) | 1134 | (isearch-yank-internal (lambda () (forward-char 1) (point)))) |
| 1120 | 1135 | ||
| @@ -1142,9 +1157,8 @@ might return the position of the end of the line." | |||
| 1142 | (defun isearch-search-and-update () | 1157 | (defun isearch-search-and-update () |
| 1143 | ;; Do the search and update the display. | 1158 | ;; Do the search and update the display. |
| 1144 | (when (or isearch-success | 1159 | (when (or isearch-success |
| 1145 | ;; unsuccessful regexp search may become | 1160 | ;; Unsuccessful regexp search may become successful by |
| 1146 | ;; successful by addition of characters which | 1161 | ;; addition of characters which make isearch-string valid |
| 1147 | ;; make isearch-string valid | ||
| 1148 | isearch-regexp | 1162 | isearch-regexp |
| 1149 | ;; If the string was found but was completely invisible, | 1163 | ;; If the string was found but was completely invisible, |
| 1150 | ;; it might now be partly visible, so try again. | 1164 | ;; it might now be partly visible, so try again. |
| @@ -1471,7 +1485,9 @@ Isearch mode." | |||
| 1471 | (command-execute scroll-command) | 1485 | (command-execute scroll-command) |
| 1472 | (let ((ab-bel (isearch-string-out-of-window isearch-point))) | 1486 | (let ((ab-bel (isearch-string-out-of-window isearch-point))) |
| 1473 | (if ab-bel | 1487 | (if ab-bel |
| 1474 | (isearch-back-into-window (eq ab-bel 'above) isearch-point))) | 1488 | (isearch-back-into-window (eq ab-bel 'above) isearch-point) |
| 1489 | (or (eq (point) isearch-point) | ||
| 1490 | (goto-char isearch-point)))) | ||
| 1475 | (isearch-update)) | 1491 | (isearch-update)) |
| 1476 | (search-exit-option | 1492 | (search-exit-option |
| 1477 | (let (window) | 1493 | (let (window) |