From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tak Kunihiro Newsgroups: gmane.emacs.devel Subject: Re: Occur should use the region as input if it's active Date: Fri, 17 Jan 2014 09:52:46 +0900 (JST) Message-ID: <20140117.095246.07098091.tkk@misasa.okayama-u.ac.jp> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1389924944 14989 80.91.229.3 (17 Jan 2014 02:15:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Jan 2014 02:15:44 +0000 (UTC) Cc: tkk@misasa.okayama-u.ac.jp To: emacs-devel@gnu.org, adatgyujto@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 17 03:15:47 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W3yyF-0004pK-V4 for ged-emacs-devel@m.gmane.org; Fri, 17 Jan 2014 03:15:44 +0100 Original-Received: from localhost ([::1]:35850 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3yyF-0002rL-Fy for ged-emacs-devel@m.gmane.org; Thu, 16 Jan 2014 21:15:43 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3xgE-0005Wv-Vv for emacs-devel@gnu.org; Thu, 16 Jan 2014 19:53:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W3xg9-0005bF-NF for emacs-devel@gnu.org; Thu, 16 Jan 2014 19:53:02 -0500 Original-Received: from msmail2.misasa.okayama-u.ac.jp ([150.46.245.7]:45461 helo=msmail.misasa.okayama-u.ac.jp) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3xg9-0005ap-Bx for emacs-devel@gnu.org; Thu, 16 Jan 2014 19:52:57 -0500 Original-Received: from localhost (pml1270.misasa.okayama-u.ac.jp [150.46.48.166]) by msmail.misasa.okayama-u.ac.jp (Postfix) with ESMTP id D0F19AF8094; Fri, 17 Jan 2014 09:52:52 +0900 (JST) In-Reply-To: X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 150.46.245.7 X-Mailman-Approved-At: Thu, 16 Jan 2014 21:15:39 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:168587 Archived-At: 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 > To: emacs-devel@gnu.org > Subject: Occur should use the region as input if it's active > Message-ID: > 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.