aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov <[email protected]>2008-06-25 20:22:14 +0000
committerJuri Linkov <[email protected]>2008-06-25 20:22:14 +0000
commit11c9f489a444c58ea1c03a6908aa8bf889407699 (patch)
treeee9bd59c7f14e7b655fab08e0c162cab5ee85730 /lisp
parent56d62ee1fba23e69035e5146a12323cdfb60ea9b (diff)
(isearch-mode-map): Bind `M-s h r' to `isearch-highlight-regexp'.
(isearch-highlight-regexp): New function.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/isearch.el21
2 files changed, 35 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f38bacea41..7813d03342 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
+2008-06-25 Juri Linkov <[email protected]>
+
+ * 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 <[email protected]>
* info.el (Info-bookmark-make-record):
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 213653ff91..130685fb88 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -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)))
+
(defun isearch-delete-char ()
"Discard last input item and move point back.