mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-26 07:33:47 +00:00
Add prefix arg to isearch-forward-symbol-at-point (bug#29321)
* lisp/isearch.el (isearch-forward-symbol-at-point): Add optional arg.
This commit is contained in:
parent
8f49cb00d0
commit
cdb0d080f1
2
etc/NEWS
2
etc/NEWS
@ -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."
|
||||
(interactive)
|
||||
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))))
|
||||
(cond
|
||||
(bounds
|
||||
(when (< (car bounds) (point))
|
||||
(goto-char (car bounds)))
|
||||
(isearch-yank-string
|
||||
(buffer-substring-no-properties (car bounds) (cdr bounds))))
|
||||
(buffer-substring-no-properties (car bounds) (cdr bounds)))
|
||||
(when count
|
||||
(isearch-repeat-forward count)))
|
||||
(t
|
||||
(setq isearch-error "No symbol at point")
|
||||
(isearch-push-state)
|
||||
|
Loading…
Reference in New Issue
Block a user