[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Yanking isearch to highlight-regexp
From: |
Juri Linkov |
Subject: |
Re: Yanking isearch to highlight-regexp |
Date: |
Wed, 30 Jul 2008 20:49:19 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) |
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/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Yanking isearch to highlight-regexp,
Juri Linkov <=