Skip to content

Commit 0b15246

Browse files
authored
Merge pull request #1554 from cydparser/lhs-navigate-imports
Fix haskell-navigate-imports-go with Bird-style
2 parents 5cf30de + f8bdea7 commit 0b15246

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

haskell-navigate-imports.el

+12-4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242

4343
(defvar haskell-navigate-imports-start-point nil)
4444

45+
(defvar haskell-literate) ; defined in haskell-mode.el
46+
4547
;;;###autoload
4648
(defun haskell-navigate-imports (&optional return)
4749
"Cycle the Haskell import lines or return to point (with prefix arg)."
@@ -81,8 +83,11 @@
8183
(progn (goto-char (point-min))
8284
(if (haskell-navigate-imports-find-forward-line)
8385
(haskell-navigate-imports-go-internal)
84-
(when (search-forward-regexp "^module" nil t 1)
85-
(search-forward "\n\n" nil t 1))))))))
86+
(let ((module (if (eq haskell-literate 'bird)
87+
"^> ?module"
88+
"^module")))
89+
(when (search-forward-regexp module nil t 1)
90+
(search-forward "\n\n" nil t 1)))))))))
8691

8792
(defun haskell-navigate-imports-goto-end ()
8893
"Skip a bunch of consecutive import lines."
@@ -105,8 +110,11 @@
105110
(defun haskell-navigate-imports-line ()
106111
"Try to match the current line as a regexp."
107112
(let ((line (buffer-substring-no-properties (line-beginning-position)
108-
(line-end-position))))
109-
(if (string-match "^import " line)
113+
(line-end-position)))
114+
(import (if (eq haskell-literate 'bird)
115+
"^> ?import "
116+
"^import ")))
117+
(if (string-match import line)
110118
line
111119
nil)))
112120

0 commit comments

Comments
 (0)