Function: isearch-yank-until-char

isearch-yank-until-char is an interactive and byte-compiled function defined in isearch.el.gz.

Signature

(isearch-yank-until-char CHAR &optional ARG)

Documentation

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.

View in manual

Probably introduced at or before Emacs version 27.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/isearch.el.gz
(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: \np")
  (isearch-yank-internal
   (lambda () (let ((inhibit-field-text-motion t))
                (condition-case nil
                    (progn
                      (search-forward (char-to-string char) nil nil arg)
                      (forward-char -1))
                  (search-failed
                   (message "`%c' not found" char)
                   (sit-for 2)))
                (point)))))