Skip to content
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

Make going forward defun work correctly with comments #1362

Merged
merged 1 commit into from
Jun 22, 2016
Merged

Make going forward defun work correctly with comments #1362

merged 1 commit into from
Jun 22, 2016

Conversation

czipperz
Copy link
Contributor

I don't know how to write a test for this because it requires the buffer to be fontified, and I don't know how to do that in batch mode.

module Test where

{- documentation here -}
fun = 13

{- document this function -}
f = 23

This patch makes going forward defuns (C-M-e) correctly go over comments.
M-< C-M-e gets you to line 2, C-M-e again gets you to line 5, C-M-e again gets you to line 8.

Before it would take you to lines 4, 7, and 8, respectively.

@geraldus
Copy link
Contributor

it requires the buffer to be fontified, and I don't know how to do that in batch mode

If I'm not mistaken this should work for you:

(ert-deftest haskell-mode-test ()
  (should (with-temp-buffer
            (haskell-mode) ;; enabling Haskell mode should fontify temporal buffer
            (eq t whatever))))

@czipperz
Copy link
Contributor Author

Tried that, doesnt work

@czipperz
Copy link
Contributor Author

czipperz commented Jun 21, 2016

Maybe I have to run syntax-ppss-flush-cache after adding the text (instead of before)... lol

@gracjan
Copy link
Contributor

gracjan commented Jun 21, 2016

(font-lock-fontify-buffer) is what you are looking for.

@czipperz
Copy link
Contributor Author

That works thanks!

@czipperz
Copy link
Contributor Author

Force pushed squashed some tests in

@gracjan gracjan merged commit 0e02958 into haskell:master Jun 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants