[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Use region as initial search regexp
From: |
Marco Wahl |
Subject: |
Re: Use region as initial search regexp |
Date: |
Mon, 27 May 2019 00:05:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> How about the following so that the default is also spliced into the
> prompt? (Also, I believe this makes sense only if the region is
> more than just an empty string.)
>
>
> (defun bbdb-search-read (&optional field)
> "Read regexp to search FIELD values of records.
> When region is active make it the default."
> (let ((default (if (and (region-active-p)
> (< (region-beginning) (region-end)))
> (buffer-substring-no-properties
> (region-beginning) (region-end)))))
> (read-string (format "Search records%s %smatching regexp: %s"
> (if field (concat " with " field) "")
> (if bbdb-search-invert "not " "")
> (if default (format "(default %s) " default) ""))
> nil nil default)))
This looks good to me. I like the display of the region in the prompt.
This way the user is not obliged to recall the M-n keybinding.
Best regards
- Use region as initial search regexp, Marco Wahl, 2019/05/23
- Re: Use region as initial search regexp, Roland Winkler, 2019/05/24
- Re: Use region as initial search regexp, Basil L. Contovounesios, 2019/05/24
- Re: Use region as initial search regexp, Roland Winkler, 2019/05/24
- Re: Use region as initial search regexp, Marco Wahl, 2019/05/25
- Re: Use region as initial search regexp, Roland Winkler, 2019/05/26
- Re: Use region as initial search regexp, Roland Winkler, 2019/05/26
- Re: Use region as initial search regexp, Marco Wahl, 2019/05/26
- Re: Use region as initial search regexp, Roland Winkler, 2019/05/26
- Re: Use region as initial search regexp,
Marco Wahl <=