From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Occur should use the region as input if it's active Date: Fri, 17 Jan 2014 10:11:12 +0200 Organization: JURTA Message-ID: <871u0758pr.fsf@mail.jurta.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1389946330 29568 80.91.229.3 (17 Jan 2014 08:12:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Jan 2014 08:12:10 +0000 (UTC) Cc: emacs-devel@gnu.org To: Tom Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 17 09:12:16 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 1W44XD-0000WE-6S for ged-emacs-devel@m.gmane.org; Fri, 17 Jan 2014 09:12:11 +0100 Original-Received: from localhost ([::1]:36750 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W44XC-0003aV-OD for ged-emacs-devel@m.gmane.org; Fri, 17 Jan 2014 03:12:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W44X4-0003Zn-T6 for emacs-devel@gnu.org; Fri, 17 Jan 2014 03:12:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W44Wy-0002kB-Tt for emacs-devel@gnu.org; Fri, 17 Jan 2014 03:12:02 -0500 Original-Received: from [69.163.184.122] (port=41625 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W44Wy-0002k5-Nj for emacs-devel@gnu.org; Fri, 17 Jan 2014 03:11:56 -0500 Original-Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.184.122]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 6A352302F77BD8; Fri, 17 Jan 2014 00:11:55 -0800 (PST) In-Reply-To: (Tom's message of "Thu, 16 Jan 2014 20:11:30 +0000 (UTC)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 69.163.184.122 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:168595 Archived-At: > Picking up the symbol around the cursor is a good idea, so for occur > it would be a good default to use the symbol around the cursor if there > is no region active and use the region for search if it's active. This can be implemented with 1-line patch: === modified file 'lisp/replace.el' --- lisp/replace.el 2013-12-20 20:31:30 +0000 +++ lisp/replace.el 2014-01-17 08:11:03 +0000 @@ -658,6 +658,7 @@ (defun read-regexp-suggestions () appends the list returned by this function to the end of values available via \\\\[next-history-element]." (list + (if (use-region-p) (buffer-substring-no-properties (region-beginning) (region-end))) (find-tag-default-as-regexp) (find-tag-default-as-symbol-regexp) (car regexp-search-ring) that uses the region as input with `M-s o down RET'. Since this looks like a new feature, until feature freeze is over, you can customize `read-regexp-defaults-function' to a function like (lambda () (list (if (use-region-p) (buffer-substring-no-properties (region-beginning) (region-end))) (find-tag-default-as-regexp))) that uses the region as input with just `M-s o RET'. > Limiting search with the region is infrequently needed and it can > easily be done with narrowing. The above two features are much > more useful and they can be used much more frequently (quickly > picking an input for occur), so they should take precedence. Yes, it's infrequently needed but still makes sense for consistency with limiting in query-replace.