From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: [PATCH] (Or "question"...) isearch-kill-found Date: Sun, 30 May 2010 17:48:21 -0700 Message-ID: References: <87iq65v61m.fsf@gnu.org> <9BE2778D1026451087EED8E656851390@us.oracle.com> <4C02E48A.7080305@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1275266931 7224 80.91.229.12 (31 May 2010 00:48:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 31 May 2010 00:48:51 +0000 (UTC) To: "'Christoph'" , Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 31 02:48:45 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OItBJ-00074R-EB for ged-emacs-devel@m.gmane.org; Mon, 31 May 2010 02:48:42 +0200 Original-Received: from localhost ([127.0.0.1]:59740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OItBI-0006hY-4s for ged-emacs-devel@m.gmane.org; Sun, 30 May 2010 20:48:40 -0400 Original-Received: from [140.186.70.92] (port=45075 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OItBB-0006eB-VI for emacs-devel@gnu.org; Sun, 30 May 2010 20:48:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OItBA-0003KO-7r for emacs-devel@gnu.org; Sun, 30 May 2010 20:48:33 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:45590) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OItBA-0003KE-06 for emacs-devel@gnu.org; Sun, 30 May 2010 20:48:32 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o4V0mStK031819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 31 May 2010 00:48:30 GMT Original-Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o4UNlNAL016335; Mon, 31 May 2010 00:48:27 GMT Original-Received: from abhmt015.oracle.com by acsmt355.oracle.com with ESMTP id 281399981275266876; Sun, 30 May 2010 17:47:56 -0700 Original-Received: from dradamslap1 (/141.144.232.13) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 30 May 2010 17:47:56 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <4C02E48A.7080305@gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Thread-Index: AcsARkN6qU1CF8oCR8ysJUpkY/7JJgAC40XQ X-Auth-Type: Internal IP X-Source-IP: acsinet15.oracle.com [141.146.126.227] X-CT-RefId: str=0001.0A090204.4C03075E.0139:SCFMA922111,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:125381 Archived-At: > > I proposed the feature to emacs-devel on 2007-07-10: > > http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00490.html > > > > The bottom line was Richard's decision: > > > > "I don't think it is needed. You can type C-@ C-r C-r to put > > the region around the match that was just found." > > In that same thread Davis Herring had an idea that sounds interesting > and useful to me: > http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00492.html > > > Thinking about this, I realize > > that I would get almost all the utility of this idea with > > just one command added to isearch which meant "exit and move > > point to start of match", or (closer to your idea) a command > > which meant "exit and drop mark at start > > of match" in place of your toggle. WDOT? > > I think a function "exit and drop mark at start of match" > would be very useful. Hm. That interesting and useful idea that "Davis Herring had" I implemented in 2006, a year before the proposal. And I pointed the list (hence Davis too) to that code. I call that command `set-region-around-search-target'.[*] (defun set-region-around-search-target () "Set the region around the last search or query-replace target." (interactive) (case last-command ((isearch-forward isearch-backward isearch-forward-regexp isearch-backward-regexp) (push-mark isearch-other-end t 'activate)) (t (push-mark (match-beginning 0) t 'activate))) (setq deactivate-mark nil)) It does exactly what he described: "drop mark at start of match". Unlike `isearchp-set-region' (the proposal), it is not conditional on the user option or on `transient-mark-mode', and thus not sensitive to the toggle key, `C-SPC'. I do not bind that command by default, but you can bind it in `isearch-map'. Or you can add it, in place of `isearchp-set-region', to `isearch-mode-end-hook'. It is in fact the _same_ as `isearchp-set-region' (the proposal) in this context, except that it is unconditional instead of respecting the toggle key. IOW, if `transient-mark-mode' is on and the option is on, then the proposed behavior is exactly what Davis described: just put mark at the match start. If t-m-mode is off and you still want the start to be marked, then use `set-region-around-search-target' instead. Here is what I proposed (I use it on `isearch-mode-end-hook'): (defun isearchp-set-region () "Set region around search target, if `isearchp-set-region-flag'. Used only for Transient Mark mode." (when (and isearchp-set-region-flag transient-mark-mode) (push-mark isearch-other-end t 'activate))) You might notice, BTW, that Davis started by saying that he does not use either transient-mark mode or delete-selection mode. Yet t-m mode is the context the feature was designed for - it is active only in t-m mode. (Transient-mark mode is now the default.) --- [*] There is perhaps a better test to use here than `last-command'. Maybe isearch has a state variable that can be checked for this - dunno.