hydra and occur-dwim
[emacs.git] / .emacs.d / elisp / local / ganneff.el
index 833cafa..ed7649d 100644 (file)
@@ -282,6 +282,18 @@ This functions should be added to the hooks of major modes for programming."
           (system-time-locale "de_DE"))
       (insert (format-time-string format))))
 
+;;;###autoload
+(defun occur-dwim ()
+  "Call `occur' with a sane default."
+  (interactive)
+  (push (if (region-active-p)
+            (buffer-substring-no-properties
+             (region-beginning)
+             (region-end))
+          (thing-at-point 'symbol))
+        regexp-history)
+  (call-interactively 'occur))
+
 (provide 'ganneff)
 
 ;;; ganneff.el ends here