]> git.eshelyaron.com Git - emacs.git/commitdiff
(isearch-mode-map): Bind `M-s h r' to `isearch-highlight-regexp'.
authorJuri Linkov <juri@jurta.org>
Wed, 25 Jun 2008 20:22:14 +0000 (20:22 +0000)
committerJuri Linkov <juri@jurta.org>
Wed, 25 Jun 2008 20:22:14 +0000 (20:22 +0000)
(isearch-highlight-regexp): New function.

lisp/ChangeLog
lisp/isearch.el

index f38bacea410573c2a35817f585e9ea213c57bff0..7813d033429d898bbb349b34658f8306fd72cea3 100644 (file)
@@ -1,3 +1,17 @@
+2008-06-25  Juri Linkov  <juri@jurta.org>
+
+       * bindings.el (goto-map): New variable.  Rebind goto-related
+       commands to this `M-g' prefix keymap.
+       (search-map): New variable for `M-s' prefix keymap.
+       Bind `M-s o' to `occur', `M-shr' to `highlight-regexp', `M-shp' to
+       `highlight-phrase', `M-shl' to `highlight-lines-matching-regexp',
+       `M-shu' to `unhighlight-regexp', `M-shf' to `hi-lock-find-patterns',
+       `M-shw' to `hi-lock-write-interactive-patterns'.
+
+       * isearch.el (isearch-mode-map): Bind `M-s h r' to
+       `isearch-highlight-regexp'.
+       (isearch-highlight-regexp): New function.
+
 2008-06-25  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * info.el (Info-bookmark-make-record):
index 213653ff9196a56306853d2a0d141b115183d126..130685fb8826180a3aa383e97a9adb61ecf0cd2f 100644 (file)
@@ -494,6 +494,7 @@ This is like `describe-bindings', but displays only isearch keys."
     (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,6 +1365,26 @@ string.  NLINES has the same meaning as in `occur'."
        (search-upper-case nil))
     (occur regexp nlines)))
 
+(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)))
+
 \f
 (defun isearch-delete-char ()
   "Discard last input item and move point back.