aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS2
-rw-r--r--lisp/isearch.el15
2 files changed, 12 insertions, 5 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 13d660812d6..dc08e1caf25 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -644,6 +644,8 @@ can now be searched via 'C-s'.
644and 'C-r' ('isearch-repeat-backward'). With a prefix argument, these 644and 'C-r' ('isearch-repeat-backward'). With a prefix argument, these
645commands repeat the search for the specified occurrence of the search string. 645commands repeat the search for the specified occurrence of the search string.
646A negative argument repeats the search in the opposite direction. 646A negative argument repeats the search in the opposite direction.
647This 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
649of matches in the Isearch prompt. Customizable variables 651of 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.
892Like ordinary incremental search except that the symbol found at point 892Like ordinary incremental search except that the symbol found at point
893is added to the search string initially as a regexp surrounded 893is added to the search string initially as a regexp surrounded
894by symbol boundary constructs \\_< and \\_>. 894by symbol boundary constructs \\_< and \\_>.
895See the command `isearch-forward-symbol' for more information." 895See the command `isearch-forward-symbol' for more information.
896 (interactive) 896With a prefix argument, search for ARGth symbol forward if ARG is
897positive, 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)