-
Notifications
You must be signed in to change notification settings - Fork 347
M-j to continue a comment on the next lines indents the next line #981
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
Comments
Are you able to add a test case to |
I can try. I opened the file and it looks straightforward to add new tests, however I didn't manage to run the existing tests. I also didn't find guidance about that in the contribution guide or readme? Before I can modify tests I must be able to run the existing ones. I guess it's basic knowledge for authors of emacs-lisp packages, but it's knowledge I just don't have currently... |
make check
|
ok this test accurately reproduces the problem: (ert-deftest haskell-indentation-altj-comment ()
(switch-to-buffer (get-buffer-create "another.hs"))
(haskell-mode)
;; (insert "-- comment") ;; <-- with this insert, it passes
(insert "main = do\n return ()\n\n-- comment")
(execute-kbd-macro (kbd "M-j"))
(should (equal 2 (count-lines (point-min) (point))))
(should (equal 3 (- (point) (line-beginning-position))))) i guess fixing the problem itself would be considerably more involved..? |
Add:
and then this test case qualified for a pull request. As about fixing it really: indentation mode currently ignores comments (treats them as whitespace), so it aligns your second comment to the tokens that were even before the first comment. Comments should be represented as a new token type. This requires some thought, but you may give it a try. |
…e next lines indents the next line
Failing testcase for bug #981: M-j to continue a comment on the next lines indents the next line
Interestingly the test that we have for this work on Emacs 25. |
@gracjan That's because they changed the function in the core. There's this included part: (comment-indent-function
;; If the previous comment is on its own line, then
;; reuse its indentation unconditionally.
;; Important for modes like Python/Haskell where
;; auto-indentation is unreliable.
(if (save-excursion (goto-char compos)
(skip-chars-backward " \t")
(bolp))
(lambda () comment-column) comment-indent-function)) |
Oh, sneaky! |
Same as #225. |
in emacs while in the middle of a comment, it's possible to ask to insert a carriage return and continue the comment on the next line.
eg, if "|" is the cursor position:
you press M-j and you should get:
but I get:
the comment continuation on the second line should not be indented.
The text was updated successfully, but these errors were encountered: