help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatically highlight all same occurrence of same stuff which has


From: Daniel Martín
Subject: Re: Automatically highlight all same occurrence of same stuff which has been currently marked/selected.
Date: Mon, 22 May 2023 13:16:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin)

Philip Kaludercic <philipk@posteo.net> writes:

>
> I have this command
>
> ;;;; Search the selected region
> (defun site/isearch-region (start end)
>   "Start isearch with the contents between START and END."
>   (interactive (if (use-region-p)
>                    (list (region-beginning) (region-end))
>                  (user-error "No region")))
>   (when (and start end)
>     (deactivate-mark)
>     (isearch-mode t)
>     (isearch-yank-string (buffer-substring start end))))
>
> (global-set-key (kbd "M-s M-s") #'site/isearch-region)
>
> that searches for whatever is selected.  That also highlights every
> occurrence.
>

And, since Emacs 28.1, one can select the region and press M-s
M-. (`isearch-forward-thing-at-point`).  By default, Emacs will try to
search for the active region first (see `isearch-forward-thing-at-point`
to customize this behavior).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]