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: RFC: [PATCH] isearch enhancements: symbol mode; syntactic filtering Date: Fri, 08 Jul 2011 22:27:47 +0300 Organization: JURTA Message-ID: <87fwmgzi6k.fsf@mail.jurta.org> References: <4E15C0BA.10400@gmail.com> <87liw9mxrh.fsf@mail.jurta.org> <4E165405.6010805@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1310153541 4478 80.91.229.12 (8 Jul 2011 19:32:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Jul 2011 19:32:21 +0000 (UTC) Cc: emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 08 21:32:16 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QfGme-00076p-49 for ged-emacs-devel@m.gmane.org; Fri, 08 Jul 2011 21:32:16 +0200 Original-Received: from localhost ([::1]:39883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfGmd-0008N8-Gm for ged-emacs-devel@m.gmane.org; Fri, 08 Jul 2011 15:32:15 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:42111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfGmP-0008Mv-1z for emacs-devel@gnu.org; Fri, 08 Jul 2011 15:32:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QfGmL-0005g8-O0 for emacs-devel@gnu.org; Fri, 08 Jul 2011 15:32:00 -0400 Original-Received: from smarty.dreamhost.com ([208.113.175.8]:51509) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfGmL-0005fp-7p for emacs-devel@gnu.org; Fri, 08 Jul 2011 15:31:57 -0400 Original-Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id 12DB36E805C; Fri, 8 Jul 2011 12:31:56 -0700 (PDT) Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 14F41451C1A5; Fri, 8 Jul 2011 12:31:54 -0700 (PDT) In-Reply-To: <4E165405.6010805@gmail.com> (Daniel Colascione's message of "Thu, 07 Jul 2011 17:49:09 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.113.175.8 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:141819 Archived-At: >>> - Syntactic filtering: control whether to match in comments, strings, and >>> normal text. >> >> This is easier to implement using `isearch-filter-predicate' as shown in >> http://thread.gmane.org/gmane.emacs.devel/34742 > > It may be easier to implement that way, but the results aren't as > good. Integrating the filtering mode into isearch allows it to be saved > along with all other isearch state. Also, my approach doesn't conflict > with other uses of isearch-filter-predicate. It would be bad design to implement all particular filter types in isearch.el. `isearch-filter-predicate' was intended to provide modular approach where additional filters can be defined only by changing the value of `isearch-filter-predicate'. But I agree with you that in its current state `isearch-filter-predicate' can cause conflicts with other uses of `isearch-filter-predicate'. It should be improved to allow adding more filters. This can be implemented by supporting a list of filters. `isearch-filter-predicate' also makes it easier to be saved along with all other isearch state - you can just save its value. >> Unfortunately, I failed to find a good keybinding for this feature, >> so it sunk into obscurity. > > The ones I proposed should be reasonably accessible, and they don't > conflict with anything useful directly from isearch. When choosing a keybinding we need to anticipate the possibility of adding more keybindings in the future. Adding a key prefix will help, e.g. `M-s f c' isearch-toggle-filter-comments `M-s f s' isearch-toggle-filter-strings `M-s f t' isearch-toggle-filter-text where `f' is short for "filter". >>> - Symbol search: like word search, but looks only at symbol boundaries >> >> This is much needed. But I think it should have a keybinding separate >> from word search. Currently, `M-s w' toggles word search, >> so a new keybinding `M-s _' could toggle symbol search. > > Adding symbol search as a new kind of word search makes sense because the > new search mode is conceptually similar to, and mutually exclusive with, > classic word search; having accepted this idea, it naturally follows to > allow users to cycle through normal, word, and symbol searches makes sense. > I have no objection to providing a way to go directly to symbol search, > however: being able to cycle backwards with a prefix argument to M-s > w would be sufficient, I think. I remember seeing exactly the same arguments in support for cycling through normal, word, and regexp searches with the same key because they are conceptually similar (word search is implemented by regexp search) and mutually exclusive. If it was decided to put them on one key, then now adding symbol search to the same key would make cycling longer. This suggests that it's better to activate all different search types with separate keys. > I like the idea of using M-_ to refer to something having to do with > symbols; in my patch, I bind this key to a function that both sets > symbol-search mode _and_ filters out matches in comments and strings; > I call it identifier-mode. I find myself wanting exactly this behavior > fairly frequently. We can certainly bikeshed a bit about the > actual keybindings. `identifier-mode' is another search type that suggests that using a separate key to enable it (e.g. `M-s i') is better than cycling.