diff options
author | Kyle Meyer <kyle@kyleam.com> | 2015-02-25 23:04:38 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2015-02-28 00:29:49 -0500 |
commit | 3acc40be3a0076fed1ddfc76c04eaf46b88c9fd2 (patch) | |
tree | 54ae8d5d90fc112c4c858d3c87e0e37377b85881 /lisp | |
parent | 04bc3adb495b48dfa37b314303345be75431693d (diff) | |
download | emacs.d-3acc40be3a0076fed1ddfc76c04eaf46b88c9fd2.tar.gz |
Add Oleh Krehel's variant of occur
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-editing.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/init-editing.el b/lisp/init-editing.el index d8a4381..6e66b9d 100644 --- a/lisp/init-editing.el +++ b/lisp/init-editing.el @@ -135,6 +135,18 @@ and '<<<' mark the bounds of the narrowed region. (call-interactively 'goto-line)) (linum-mode -1))) +;; Modified from http://oremacs.com/2015/01/26/occur-dwim/. +(defun km/occur () + "Call `occur' with active region or symbol at point." + (interactive) + (push (if (use-region-p) + (buffer-substring-no-properties + (region-beginning) + (region-end)) + (thing-at-point 'symbol)) + regexp-history) + (call-interactively 'occur)) + (global-set-key (kbd "C-x \\") 'align-regexp) (global-set-key (kbd "C-;") 'er/expand-region) @@ -155,6 +167,8 @@ and '<<<' mark the bounds of the narrowed region. (define-key narrow-map "c" 'km/narrow-to-comment-heading) +;; Override default `occur'. +(define-key search-map "o" 'km/occur) (define-key search-map "s" 'query-replace) (define-key search-map "S" 'replace-string) (define-key search-map "r" 'query-replace-regexp) |