emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Yanking isearch to highlight-regexp


From: Lennart Borgman (gmail)
Subject: Re: Yanking isearch to highlight-regexp
Date: Sun, 15 Jun 2008 11:47:34 +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

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?
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))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]