From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Yanking isearch to highlight-regexp Date: Sun, 15 Jun 2008 11:47:34 +0200 Message-ID: <4854E536.8040407@gmail.com> References: <4853F884.7000609@gmail.com> <7dbe73ed0806141442h342f8ff0u83863f3980a7e229@mail.gmail.com> <48545D78.8080103@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080002030405080102040603" X-Trace: ger.gmane.org 1213523781 19957 80.91.229.12 (15 Jun 2008 09:56:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Jun 2008 09:56:21 +0000 (UTC) Cc: Emacs Devel , Mathias Dahl To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 15 11:57:04 2008 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.50) id 1K7oyp-00086t-VZ for ged-emacs-devel@m.gmane.org; Sun, 15 Jun 2008 11:57:00 +0200 Original-Received: from localhost ([127.0.0.1]:40773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7oy0-0007HD-E4 for ged-emacs-devel@m.gmane.org; Sun, 15 Jun 2008 05:56:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7opu-0005nY-C5 for emacs-devel@gnu.org; Sun, 15 Jun 2008 05:47:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7opo-0005mg-Ot for emacs-devel@gnu.org; Sun, 15 Jun 2008 05:47:42 -0400 Original-Received: from [199.232.76.173] (port=53501 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7opo-0005mR-CQ for emacs-devel@gnu.org; Sun, 15 Jun 2008 05:47:40 -0400 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]:34835) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K7opn-0000M1-Ve for emacs-devel@gnu.org; Sun, 15 Jun 2008 05:47:40 -0400 Original-Received: from c83-254-145-59.bredband.comhem.se ([83.254.145.59]:63255 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1K7opl-00034T-6p; Sun, 15 Jun 2008 11:47:37 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: X-Antivirus: avast! (VPS 080615-0, 2008-06-15), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.145.59 X-Scan-Result: No virus found in message 1K7opl-00034T-6p. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1K7opl-00034T-6p fadf5689febc2ab3aef33750249ddf31 X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) 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:99251 Archived-At: This is a multi-part message in MIME format. --------------080002030405080102040603 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Stefan Monnier wrote: >> One possibility is of course bind it to C-x w h in isearch, like in >> hi-lock-mode. Could that possible disturb? > > C-x exits isearch, so it would be difficult to do. If highlight-regexp was always bound to C-x w h then something like the simple patched attached could be used. Of course the test for `last-command' could be made a bit more pretty ... Why is not C-x w h always bound to higlight-regexp? --------------080002030405080102040603 Content-Type: text/plain; name="hi-lock-from-isearch.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="hi-lock-from-isearch.diff" Index: hi-lock.el =================================================================== RCS file: /sources/emacs/emacs/lisp/hi-lock.el,v retrieving revision 1.51 diff -u -r1.51 hi-lock.el --- hi-lock.el 6 May 2008 07:57:38 -0000 1.51 +++ hi-lock.el 15 Jun 2008 09:42:35 -0000 @@ -421,7 +421,12 @@ (list (hi-lock-regexp-okay (read-from-minibuffer "Regexp to highlight: " - (cons (or (car hi-lock-regexp-history) "") 1 ) + (cons (or (when (eq last-command + 'isearch-other-control-char) + (if isearch-regexp + isearch-string + (regexp-quote isearch-string))) + (car hi-lock-regexp-history) "") 1 ) nil nil 'hi-lock-regexp-history)) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-yellow)) --------------080002030405080102040603--