Skip to content

Navigate to top level declaration in indenatation #921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions haskell-indentation.el
Original file line number Diff line number Diff line change
Expand Up @@ -603,11 +603,18 @@ the current buffer."
(while (not (bobp))
(forward-comment (- (buffer-size)))
(beginning-of-line)
(let ((ps (nth 8 (syntax-ppss))))
(when ps ;; inside comment or string
(goto-char ps)))
(when (= 0 (haskell-indentation-current-indentation))
(throw 'return nil))))
(let* ((ps (syntax-ppss))
(start-of-comment-or-string (nth 8 ps))
(start-of-list-expression (nth 1 ps)))
(cond
(start-of-comment-or-string
;; inside comment or string
(goto-char start-of-comment-or-string))
(start-of-list-expression
;; inside a parenthesized expression
(goto-char start-of-list-expression))
((= 0 (haskell-indentation-current-indentation))
(throw 'return nil))))))
(beginning-of-line)
(when (bobp)
(forward-comment (buffer-size)))))
Expand Down
6 changes: 4 additions & 2 deletions tests/haskell-indentation-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -625,12 +625,14 @@ foo = ()
((4 0) 0))


(hindent-test "34* beginning of line inside parentheses" "
(hindent-test "34 beginning of line inside parentheses" "
data T = T {
foo :: String
, bar :: String
}

"
((5 0) 0))
;; set of answers isn't best but it is not a bug
;; should be just 0
((5 0) 0 9))
;;; haskell-indentation-tests.el ends here