[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PATCH: isearch-yank-until-char
From: |
Karl Fogel |
Subject: |
Re: PATCH: isearch-yank-until-char |
Date: |
Thu, 15 Aug 2019 23:53:44 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
On 14 Aug 2019, Juri Linkov wrote:
>Globally 'C-M-c' is bound to 'exit-recursive-edit', so the question is
>does anyone want 'C-M-c' to quit isearch and execute 'exit-recursive-edit'?
>I never used 'C-M-c' to quit isearch.
Neither have I.
>One problem is that typing 'C-s C-M-c <SPC>' at the end of the buffer
>raises the error:
>
> Debugger entered--Lisp error: (search-failed " ")
> search-forward(" ")
> isearch-yank-until-char(32)
> funcall-interactively(isearch-yank-until-char 32)
> call-interactively(isearch-yank-until-char nil nil)
> command-execute(isearch-yank-until-char)
>
>and leaves isearch in a broken state. Should your new command
>catch this error?
It could. I'm not sure exacly what to do with the error, though. The new
version below displays a brief message and then returns to the isearch prompt:
(defun isearch-yank-until-char (char)
"Pull everything until next instance of CHAR from buffer into search string.
Interactively, prompt for CHAR."
(interactive "cYank until character: ")
(isearch-yank-internal
(lambda () (let ((inhibit-field-text-motion t))
(condition-case nil
(progn
(search-forward (char-to-string char))
(forward-char -1))
(search-failed
(message "`%c' not found" char)
(sit-for 2)))
(point)))))
This feels klugey, but I'm not sure what a better way is. Do you have any
ideas?
I also tried raising an error -- i.e., substitute `message' above with `error'
and get rid of the `(sit-for 2)' -- but the problem with that is that it
*never* returns to the isearch prompt, even though in either case isearch is
still active and one could continue adding to the search string.
Best regards,
-Karl
- Re: PATCH: isearch-yank-until-char, (continued)
Re: PATCH: isearch-yank-until-char, Noam Postavsky, 2019/08/14
Re: PATCH: isearch-yank-until-char, Juri Linkov, 2019/08/14
- Re: PATCH: isearch-yank-until-char,
Karl Fogel <=
- Re: PATCH: isearch-yank-until-char, Juri Linkov, 2019/08/16
- Re: PATCH: isearch-yank-until-char, Karl Fogel, 2019/08/24
- RE: PATCH: isearch-yank-until-char, Drew Adams, 2019/08/24
- Re: PATCH: isearch-yank-until-char, Juri Linkov, 2019/08/25
- RE: PATCH: isearch-yank-until-char, Drew Adams, 2019/08/25
- Re: PATCH: isearch-yank-until-char, Karl Fogel, 2019/08/26
- RE: PATCH: isearch-yank-until-char, Drew Adams, 2019/08/26
- Re: PATCH: isearch-yank-until-char, Karl Fogel, 2019/08/26
- RE: PATCH: isearch-yank-until-char, Drew Adams, 2019/08/26
- Re: PATCH: isearch-yank-until-char, Karl Fogel, 2019/08/26