diff options
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/isearch.el | 15 |
2 files changed, 12 insertions, 5 deletions
| @@ -644,6 +644,8 @@ can now be searched via 'C-s'. | |||
| 644 | and 'C-r' ('isearch-repeat-backward'). With a prefix argument, these | 644 | and 'C-r' ('isearch-repeat-backward'). With a prefix argument, these |
| 645 | commands repeat the search for the specified occurrence of the search string. | 645 | commands repeat the search for the specified occurrence of the search string. |
| 646 | A negative argument repeats the search in the opposite direction. | 646 | A negative argument repeats the search in the opposite direction. |
| 647 | This makes possible also to use a prefix argument for 'M-s .' | ||
| 648 | ('isearch-forward-symbol-at-point') to find the next Nth symbol. | ||
| 647 | 649 | ||
| 648 | *** 'isearch-lazy-count' shows the current match number and total number | 650 | *** 'isearch-lazy-count' shows the current match number and total number |
| 649 | of matches in the Isearch prompt. Customizable variables | 651 | of matches in the Isearch prompt. Customizable variables |
diff --git a/lisp/isearch.el b/lisp/isearch.el index 6d94ef66931..b05805ccd6d 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -887,21 +887,26 @@ as a regexp. See the command `isearch-forward-regexp' for more information." | |||
| 887 | (interactive "P\np") | 887 | (interactive "P\np") |
| 888 | (isearch-mode nil (null not-regexp) nil (not no-recursive-edit))) | 888 | (isearch-mode nil (null not-regexp) nil (not no-recursive-edit))) |
| 889 | 889 | ||
| 890 | (defun isearch-forward-symbol-at-point () | 890 | (defun isearch-forward-symbol-at-point (&optional arg) |
| 891 | "Do incremental search forward for a symbol found near point. | 891 | "Do incremental search forward for a symbol found near point. |
| 892 | Like ordinary incremental search except that the symbol found at point | 892 | Like ordinary incremental search except that the symbol found at point |
| 893 | is added to the search string initially as a regexp surrounded | 893 | is added to the search string initially as a regexp surrounded |
| 894 | by symbol boundary constructs \\_< and \\_>. | 894 | by symbol boundary constructs \\_< and \\_>. |
| 895 | See the command `isearch-forward-symbol' for more information." | 895 | See the command `isearch-forward-symbol' for more information. |
| 896 | (interactive) | 896 | With a prefix argument, search for ARGth symbol forward if ARG is |
| 897 | positive, or search for ARGth symbol backward if ARG is negative." | ||
| 898 | (interactive "P") | ||
| 897 | (isearch-forward-symbol nil 1) | 899 | (isearch-forward-symbol nil 1) |
| 898 | (let ((bounds (find-tag-default-bounds))) | 900 | (let ((bounds (find-tag-default-bounds)) |
| 901 | (count (and arg (prefix-numeric-value arg)))) | ||
| 899 | (cond | 902 | (cond |
| 900 | (bounds | 903 | (bounds |
| 901 | (when (< (car bounds) (point)) | 904 | (when (< (car bounds) (point)) |
| 902 | (goto-char (car bounds))) | 905 | (goto-char (car bounds))) |
| 903 | (isearch-yank-string | 906 | (isearch-yank-string |
| 904 | (buffer-substring-no-properties (car bounds) (cdr bounds)))) | 907 | (buffer-substring-no-properties (car bounds) (cdr bounds))) |
| 908 | (when count | ||
| 909 | (isearch-repeat-forward count))) | ||
| 905 | (t | 910 | (t |
| 906 | (setq isearch-error "No symbol at point") | 911 | (setq isearch-error "No symbol at point") |
| 907 | (isearch-push-state) | 912 | (isearch-push-state) |