[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master cdb0d08: Add prefix arg to isearch-forward-symbol-a
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] master cdb0d08: Add prefix arg to isearch-forward-symbol-at-point (bug#29321) |
Date: |
Wed, 21 Nov 2018 16:33:30 -0500 (EST) |
branch: master
commit cdb0d080f1bb2239ccb828d989d6bb73409d5f59
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>
Add prefix arg to isearch-forward-symbol-at-point (bug#29321)
* lisp/isearch.el (isearch-forward-symbol-at-point): Add optional arg.
---
etc/NEWS | 2 ++
lisp/isearch.el | 15 ++++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 13d6608..dc08e1c 100644
--- a/etc/NEWS
+++ b/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
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 6d94ef6..b05805c 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."
(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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master cdb0d08: Add prefix arg to isearch-forward-symbol-at-point (bug#29321),
Juri Linkov <=