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.
+Also a prefix argument is supported for 'isearch-yank-until-char',
+'isearch-yank-word-or-char', 'isearch-yank-symbol-or-char'.
*** To go to the first/last occurrence of the current search string
is possible now with new commands 'isearch-beginning-of-buffer' and
(interactive "p")
(isearch-yank-internal (lambda () (forward-char arg) (point))))
-(defun isearch--yank-char-or-syntax (syntax-list fn)
+(defun isearch--yank-char-or-syntax (syntax-list fn &optional arg)
(isearch-yank-internal
(lambda ()
- (if (or (memq (char-syntax (or (char-after) 0)) syntax-list)
- (memq (char-syntax (or (char-after (1+ (point))) 0))
- syntax-list))
- (funcall fn 1)
- (forward-char 1))
+ (dotimes (_ arg)
+ (if (or (memq (char-syntax (or (char-after) 0)) syntax-list)
+ (memq (char-syntax (or (char-after (1+ (point))) 0))
+ syntax-list))
+ (funcall fn 1)
+ (forward-char 1)))
(point))))
-(defun isearch-yank-word-or-char ()
- "Pull next character or word from buffer into search string."
- (interactive)
- (isearch--yank-char-or-syntax '(?w) 'forward-word))
+(defun isearch-yank-word-or-char (&optional arg)
+ "Pull next character or word from buffer into search string.
+If optional ARG is non-nil, pull in the next ARG characters/words."
+ (interactive "p")
+ (isearch--yank-char-or-syntax '(?w) 'forward-word arg))
-(defun isearch-yank-symbol-or-char ()
- "Pull next character or symbol from buffer into search string."
- (interactive)
- (isearch--yank-char-or-syntax '(?w ?_) 'forward-symbol))
+(defun isearch-yank-symbol-or-char (&optional arg)
+ "Pull next character or symbol from buffer into search string.
+If optional ARG is non-nil, pull in the next ARG characters/symbols."
+ (interactive "p")
+ (isearch--yank-char-or-syntax '(?w ?_) 'forward-symbol arg))
(defun isearch-yank-word (&optional arg)
"Pull next word from buffer into search string.
(interactive "p")
(isearch-yank-internal (lambda () (forward-word arg) (point))))
-(defun isearch-yank-until-char (char)
+(defun isearch-yank-until-char (char &optional arg)
"Pull everything until next instance of CHAR from buffer into search string.
Interactively, prompt for CHAR.
+If optional ARG is non-nil, pull until next ARGth instance of CHAR.
This is often useful for keyboard macros, for example in programming
languages or markup languages in which CHAR marks a token boundary."
- (interactive "cYank until character: ")
+ (interactive "cYank until character: \np")
(isearch-yank-internal
(lambda () (let ((inhibit-field-text-motion t))
(condition-case nil
(progn
- (search-forward (char-to-string char))
+ (search-forward (char-to-string char) nil nil arg)
(forward-char -1))
(search-failed
(message "`%c' not found" char)