Commit cdb0d080 authored by Juri Linkov's avatar Juri Linkov

Add prefix arg to isearch-forward-symbol-at-point (bug#29321)

* lisp/isearch.el (isearch-forward-symbol-at-point): Add optional arg.
parent 8f49cb00
Pipeline #113 failed with stage
in 21 minutes and 41 seconds
......@@ -644,6 +644,8 @@ can now be searched via 'C-s'.
and 'C-r' ('isearch-repeat-backward'). With a prefix argument, these
commands repeat the search for the specified occurrence of the search string.
A negative argument repeats the search in the opposite direction.
This makes possible also to use a prefix argument for 'M-s .'
('isearch-forward-symbol-at-point') to find the next Nth symbol.
*** 'isearch-lazy-count' shows the current match number and total number
of matches in the Isearch prompt. Customizable variables
......@@ -887,21 +887,26 @@ as a regexp. See the command `isearch-forward-regexp' for more information."
(interactive "P\np")
(isearch-mode nil (null not-regexp) nil (not no-recursive-edit)))
(defun isearch-forward-symbol-at-point ()
(defun isearch-forward-symbol-at-point (&optional arg)
"Do incremental search forward for a symbol found near point.
Like ordinary incremental search except that the symbol found at point
is added to the search string initially as a regexp surrounded
by symbol boundary constructs \\_< and \\_>.
See the command `isearch-forward-symbol' for more information."
See the command `isearch-forward-symbol' for more information.
With a prefix argument, search for ARGth symbol forward if ARG is
positive, or search for ARGth symbol backward if ARG is negative."
(interactive "P")
(isearch-forward-symbol nil 1)
(let ((bounds (find-tag-default-bounds)))
(let ((bounds (find-tag-default-bounds))
(count (and arg (prefix-numeric-value arg))))
(when (< (car bounds) (point))
(goto-char (car bounds)))
(buffer-substring-no-properties (car bounds) (cdr bounds))))
(buffer-substring-no-properties (car bounds) (cdr bounds)))
(when count
(isearch-repeat-forward count)))
(setq isearch-error "No symbol at point")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment