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

single line comment highlights the following lines as comments #1828

Closed
scabug opened this issue Mar 26, 2009 · 4 comments
Closed

single line comment highlights the following lines as comments #1828

scabug opened this issue Mar 26, 2009 · 4 comments
Assignees

Comments

@scabug
Copy link

scabug commented Mar 26, 2009

Open the following file in scala-mode in emacs:

////// abc 
asd
das
das
das
asd

Each extra pair of // adds one more line below the comment that is highlighted as a comment. In the above example, the first two lines below the comment are highlighted as comments.

@scabug
Copy link
Author

scabug commented Mar 26, 2009

Imported From: https://issues.scala-lang.org/browse/SI-1828?orig=1
Reporter: @dragos

@scabug
Copy link
Author

scabug commented Jun 9, 2009

Anders Bach Nielsen [X] (nielsen) said:
This is a limitation of Emacs where the syntax choosen for Scala can not be handled by Emacs.
Let me try to explain the problem.
In Scala there are two kinds of comments, the single line // and the multiline /* / comments. However these comment are allowed to be nested so / /* **/ **/ is perfectly ok. If this was the only comment then it would not be a problem, however because // uses the same characters to indicate single line comment emacs goes bad :-/ If the single line comment should be ## or something that does not include a /, then emacs would be able to handle it.

So basically, this is a limitation in emacs itself and it cant be fixed as it is (or to my knowledge). Sorry

@scabug
Copy link
Author

scabug commented Nov 2, 2011

Suraj Acharya (surajacharya) said:
I was able to fix the reported problem by setting the nested comment flag only for '/* ... */' style comments. scala-mode.el needs the following changes :

@@ -142,10 +142,10 @@

;; comments
;; the `n' means that comments can be nested

  • (modify-syntax-entry ?/ ". 124nb" scala-mode-syntax-table)
  • (modify-syntax-entry ?/ ". 124b" scala-mode-syntax-table)
    (modify-syntax-entry ?* ". 23n" scala-mode-syntax-table)
  • (modify-syntax-entry ?\n "> bn" scala-mode-syntax-table)
  • (modify-syntax-entry ?\r "> bn" scala-mode-syntax-table))
  • (modify-syntax-entry ?\n "> b" scala-mode-syntax-table)
  • (modify-syntax-entry ?\r "> b" scala-mode-syntax-table))

;;; Mode

This allows nesting of '/* ... */' comments and only comments one line for '/////...' comments.

@scabug
Copy link
Author

scabug commented Jul 17, 2015

@SethTisue said:
emacs mode work continues at https://github.com/hvesalai/scala-mode2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants