[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Occur should use the region as input if it's active
From: |
Tak Kunihiro |
Subject: |
Re: Occur should use the region as input if it's active |
Date: |
Fri, 17 Jan 2014 09:52:46 +0900 (JST) |
I think that is a good idea and should be build in with following two
lines. With this, isearch and occur get closer.
(isearch-mode t)
(isearch-update-ring (setq isearch-string (buffer-substring-no-properties
(region-beginning) (region-end))))
> Date: Thu, 16 Jan 2014 18:55:48 +0000 (UTC)
> From: Tom <address@hidden>
> To: address@hidden
> Subject: Occur should use the region as input if it's active
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> If often happens to me that I'm perusing a buffer and I want to
> search for some word or phrase in it. To do this I simply select the
> text and use this code to instantly get occur matches of it:
>
> (defun my-occur ()
> (interactive)
> (if (use-region-p)
> (occur (buffer-substring-no-properties
> (region-beginning) (region-end)))
> (call-interactively 'occur)))
>
> Shouldn't the builtin occur do this? It's quite convenient and
> efficient and in my experience most of the occur searches are
> of these kind (searching for something I see) and it's less
> often that I actualy need to type in the search term.