Skip to content

Commit 1bcabce

Browse files
committed
Added `haskell-rgrep' for grepping the effective project
I've been using this function for some months, might as well add it to haskell-mode. I tend to use the keybinding M-, as a kind of complement to M-.
1 parent f41ae73 commit 1bcabce

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

haskell-mode.el

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142
(declare-function haskell-session-cabal-dir "haskell-session" (session))
143143
(declare-function haskell-session-maybe "haskell-session" ())
144144
(declare-function haskell-session-tags-filename "haskell-session" (session))
145+
(declare-function haskell-session-current-dir "haskell-session" (session))
145146

146147
;; All functions/variables start with `(literate-)haskell-'.
147148

@@ -868,6 +869,18 @@ remains unchanged."
868869
(kill-region (match-beginning 0) (match-end 0))
869870
(error "No SCC at point")))))
870871

872+
(defun haskell-rgrep (&optional prompt)
873+
"Grep the effective project for the symbol at point. Very
874+
useful for codebase navigation. Prompts for an arbitrary regexp
875+
given a prefix arg."
876+
(interactive "P")
877+
(let ((sym (if prompt
878+
(read-from-minibuffer "Look for: ")
879+
(haskell-ident-at-point))))
880+
(rgrep sym
881+
"*.hs" ;; TODO: common Haskell extensions.
882+
(haskell-session-current-dir (haskell-session)))))
883+
871884

872885
;; Provide ourselves:
873886

0 commit comments

Comments
 (0)