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, 25 Jun 2008 02:09:36 +0300 Organization: JURTA Message-ID: <87y74ubfnc.fsf@jurta.org> References: <4853F884.7000609@gmail.com> <7dbe73ed0806141442h342f8ff0u83863f3980a7e229@mail.gmail.com> <48545D78.8080103@gmail.com> <4854E536.8040407@gmail.com> <87k5gql900.fsf@jurta.org> <87hcbt59s6.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 1214349264 23826 80.91.229.12 (24 Jun 2008 23:14:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Jun 2008 23:14:24 +0000 (UTC) Cc: "Lennart Borgman \(gmail\)" , emacs-devel@gnu.org To: David Koppelman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 25 01:15:09 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 1KBHj7-0005u5-23 for ged-emacs-devel@m.gmane.org; Wed, 25 Jun 2008 01:15:05 +0200 Original-Received: from localhost ([127.0.0.1]:58382 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KBHiH-00008T-94 for ged-emacs-devel@m.gmane.org; Tue, 24 Jun 2008 19:14:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KBHiD-00008O-Ii for emacs-devel@gnu.org; Tue, 24 Jun 2008 19:14:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KBHiC-000088-Js for emacs-devel@gnu.org; Tue, 24 Jun 2008 19:14:09 -0400 Original-Received: from [199.232.76.173] (port=43825 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KBHiC-000085-Fa for emacs-devel@gnu.org; Tue, 24 Jun 2008 19:14:08 -0400 Original-Received: from relay02.kiev.sovam.com ([62.64.120.197]:57858) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KBHiB-0008Gb-S4 for emacs-devel@gnu.org; Tue, 24 Jun 2008 19:14:08 -0400 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay02.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1KBHi8-000Jwa-Av; Wed, 25 Jun 2008 02:14:04 +0300 In-Reply-To: (David Koppelman's message of "Tue, 17 Jun 2008 13:50:23 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: 33ca3efb02d57e4381ef3dfbedf9ea6a X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Trusted X-SpamTest-Info: Profiles 4070 [June 25 2008] X-SpamTest-Info: {received from trusted relay: common white list} X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: white ip list X-SpamTest-Rate: 10 X-SpamTest-Status: Trusted X-SpamTest-Status-Extended: trusted X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) 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:99875 Archived-At: > That sounds good. I'd like to submit a series of patches instead of lumping all changes together in one patch. The first patch below adds a new global prefix key M-s for search related commands. It provides global bindings for the often used command `occur' and a set of hi-lock commands with the mnemonic subprefix key `h'. But I'm not sure if a better way to do this is to define a new key map explicitly, e.g. with the name like "search-map"? Index: lisp/bindings.el =================================================================== RCS file: /sources/emacs/emacs/lisp/bindings.el,v retrieving revision 1.207 diff -c -r1.207 bindings.el *** lisp/bindings.el 5 Jun 2008 19:59:15 -0000 1.207 --- lisp/bindings.el 24 Jun 2008 23:00:45 -0000 *************** *** 815,820 **** --- 815,828 ---- (define-key esc-map "gp" 'previous-error) (define-key esc-map "g\M-p" 'previous-error) + (define-key esc-map "so" 'occur) + (define-key esc-map "shr" 'highlight-regexp) + (define-key esc-map "shp" 'highlight-phrase) + (define-key esc-map "shl" 'highlight-lines-matching-regexp) + (define-key esc-map "shu" 'unhighlight-regexp) + (define-key esc-map "shf" 'hi-lock-find-patterns) + (define-key esc-map "shw" 'hi-lock-write-interactive-patterns) + ;;(defun function-key-error () ;; (interactive) ;; (error "That function key is not bound to anything")) Index: lisp/isearch.el =================================================================== RCS file: /sources/emacs/emacs/lisp/isearch.el,v retrieving revision 1.321 diff -c -r1.321 isearch.el *** lisp/isearch.el 11 May 2008 20:30:27 -0000 1.321 --- lisp/isearch.el 24 Jun 2008 23:00:38 -0000 *************** *** 494,499 **** --- 494,500 ---- (define-key map [?\M-%] 'isearch-query-replace) (define-key map [?\C-\M-%] 'isearch-query-replace-regexp) (define-key map "\M-so" 'isearch-occur) + (define-key map "\M-shr" 'isearch-highlight-regexp) map) "Keymap for `isearch-mode'.") *************** *** 1364,1369 **** --- 1365,1385 ---- (search-upper-case nil)) (occur regexp nlines))) + (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 + (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 () "Discard last input item and move point back. -- Juri Linkov http://www.jurta.org/emacs/