2023-05-16 11:18:38 +02:00
|
|
|
;; *** Occur
|
|
|
|
|
;; https://oremacs.com/2015/01/26/occur-dwim/
|
|
|
|
|
;; https://github.com/abo-abo/hydra/wiki/Emacs
|
|
|
|
|
(defun occur-dwim ()
|
|
|
|
|
"Call `occur' with a sane default, chosen as the thing under point or selected region"
|
|
|
|
|
(interactive)
|
|
|
|
|
(push (if (region-active-p)
|
|
|
|
|
(buffer-substring-no-properties
|
|
|
|
|
(region-beginning)
|
|
|
|
|
(region-end))
|
|
|
|
|
(let ((sym (thing-at-point 'symbol)))
|
|
|
|
|
(when (stringp sym)
|
|
|
|
|
(regexp-quote sym))))
|
|
|
|
|
regexp-history)
|
|
|
|
|
(call-interactively 'occur))
|
|
|
|
|
|
2023-06-16 12:23:33 +02:00
|
|
|
(use-package loccur
|
|
|
|
|
:bind
|
|
|
|
|
(("C-o" . loccur-current)))
|
2023-05-16 11:18:38 +02:00
|
|
|
|
|
|
|
|
(provide 'init-occur)
|
|
|
|
|
;;; init-occur.el ends here
|