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: Yanking isearch to highlight-regexp Date: Wed, 30 Jul 2008 20:49:19 +0300 Organization: JURTA Message-ID: <878wvj5kkg.fsf@jurta.org> References: <4853F884.7000609@gmail.com> <7dbe73ed0806141442h342f8ff0u83863f3980a7e229@mail.gmail.com> <48545D78.8080103@gmail.com> <4854E536.8040407@gmail.com> <87k5gql900.fsf@jurta.org> <878wwp1an8.fsf@jurta.org> <871w2gi58m.fsf@jurta.org> <87d4m0c9md.fsf@jurta.org> <87wsk89byj.fsf@jurta.org> <87bq1ihey5.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1217440271 7588 80.91.229.12 (30 Jul 2008 17:51:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Jul 2008 17:51:11 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 30 19:52:00 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 1KOFpx-0006XF-DJ for ged-emacs-devel@m.gmane.org; Wed, 30 Jul 2008 19:51:45 +0200 Original-Received: from localhost ([127.0.0.1]:40958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KOFp3-0002mt-1f for ged-emacs-devel@m.gmane.org; Wed, 30 Jul 2008 13:50:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KOFox-0002ky-Lc for emacs-devel@gnu.org; Wed, 30 Jul 2008 13:50:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KOFov-0002gJ-EW for emacs-devel@gnu.org; Wed, 30 Jul 2008 13:50:42 -0400 Original-Received: from [199.232.76.173] (port=53072 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KOFov-0002fg-62 for emacs-devel@gnu.org; Wed, 30 Jul 2008 13:50:41 -0400 Original-Received: from smtp-out.neti.ee ([194.126.126.37]:47826) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KOFou-0007O4-If for emacs-devel@gnu.org; Wed, 30 Jul 2008 13:50:40 -0400 X-Virus-Scanned: Debian amavisd-new at estpak.ee Original-Received: from Relayhost1.neti.ee (Relayhost1 [88.196.174.141]) by MXR-8.estpak.ee (Postfix) with ESMTP id B9C0B148DF9 for ; Wed, 30 Jul 2008 20:50:35 +0300 (EEST) Original-Received: from mail.estpak.ee (66.132.191.90.dyn.estpak.ee [90.191.132.66]) by Relayhost1.neti.ee (Postfix) with ESMTP id BC2E92A4A2A for ; Wed, 30 Jul 2008 20:50:36 +0300 (EEST) In-Reply-To: <87bq1ihey5.fsf@jurta.org> (Juri Linkov's message of "Mon, 30 Jun 2008 22:59:14 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-detected-kernel: by monty-python.gnu.org: 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:101768 Archived-At: One problem with `isearch-highlight-regexp': after typing `M-s h r' in Isearch mode, it asks for the face name in the minibuffer but Isearch mode is still active with its keybindings. Two calls to (isearch-clean-overlays) and (isearch-done) could be moved to the interactive spec before calling `hi-lock-read-face-name' with the assumption that `isearch-highlight-regexp' will be never used non-interactively. But in this case the functions arguments `(regexp &optional face)' make no sense. So it seems we should drop the idea of keeping the function arguments the same as in `highlight-regexp' and change `isearch-highlight-regexp' as follows: Index: lisp/isearch.el =================================================================== RCS file: /sources/emacs/emacs/lisp/isearch.el,v retrieving revision 1.325 diff -c -r1.325 isearch.el *** lisp/isearch.el 30 Jul 2008 16:40:23 -0000 1.325 --- lisp/isearch.el 30 Jul 2008 17:48:40 -0000 *************** *** 1394,1415 **** (declare-function hi-lock-regexp-okay "hi-lock" (regexp)) (declare-function hi-lock-read-face-name "hi-lock" ()) ! (defun isearch-highlight-regexp (regexp &optional face) "Run `highlight-regexp' with regexp from the current search string. ! Interactively, REGEXP is the current search regexp or a quoted search ! string. FACE has the same meaning as in `highlight-regexp'." ! (interactive ! (list ! (progn ! (require 'hi-lock nil t) ! (hi-lock-regexp-okay ! (if isearch-regexp isearch-string (regexp-quote isearch-string)))) ! (hi-lock-read-face-name))) (isearch-done) (isearch-clean-overlays) ;; (add-to-history 'hi-lock-regexp-history regexp) ! (let ((case-fold-search isearch-case-fold-search)) ! (hi-lock-face-buffer regexp face))) (defun isearch-delete-char () --- 1394,1416 ---- (declare-function hi-lock-regexp-okay "hi-lock" (regexp)) (declare-function hi-lock-read-face-name "hi-lock" ()) ! (defun isearch-highlight-regexp () "Run `highlight-regexp' with regexp from the current search string. ! It exits Isearch mode and calls `hi-lock-face-buffer' with its regexp ! argument from the last search regexp or a quoted search string, ! and reads its face argument using `hi-lock-read-face-name'." ! (interactive) (isearch-done) (isearch-clean-overlays) + (require 'hi-lock nil t) ;; (add-to-history 'hi-lock-regexp-history regexp) ! (let ((case-fold-search isearch-case-fold-search)) ! (hi-lock-face-buffer ! (hi-lock-regexp-okay ! (if isearch-regexp isearch-string (regexp-quote isearch-string))) ! (hi-lock-read-face-name)))) (defun isearch-delete-char () -- Juri Linkov http://www.jurta.org/emacs/