Project

General

Profile

Bug #469

Emacs UI: keywords in multiline comments

Added by John Abbott about 10 years ago. Updated 3 months ago.

Status:
Resolved
Priority:
Low
Assignee:
-
Category:
EmacsUI
Target version:
Start date:
12 Mar 2014
Due date:
% Done:

20%

Estimated time:
Spent time:

Description

The close block fn C-c C-e gets confused by unclosed code blocks inside multiline comments. Here is an example:

/*  Define abc(X)
      If X > 0 Then
 */

If you type C-c C-e with the cursor immediately after this comment, it happily inserts EndIf; and if you do it again, then EndDefine appears!

I regard this as quite unimportant, so low priority.


Related issues

Related to CoCoA-5 - Bug #471: Nested multiline commentsClosed2014-03-12

Related to CoCoA-5 - Design #481: Multiline comments -- obsolescent?Closed2014-03-18

History

#1 Updated by John Abbott about 10 years ago

I fear that it would be quite tricky to solve this one properly. Reverse scanning to decide if some line is inside a multiline comment would be tricky and costly -- if it is not in a multiline comment then you must check right back to the first character of the input file because the file could start with /*.

Whoever wants to implement this must remember that the substrings /* and */ could appear inside end-of-line comments. I do not recall what happens if multiline comments are nested.

The more I think about it, the more it seems that multiline comments are evil (as far as a simple reverse parser is concerned). Can we ban them? :-)

#2 Updated by John Abbott about 10 years ago

  • Category set to EmacsUI

I think this issue is unimportant because it is hard to imagine when someone would use a multiline comment to comment out syntactically incomplete blocks of code. There could still be problems with commented out syntactically complete and correct code which contains string literals which contain keywords... sigh!

Let's make multiline comments obsolescent! :-)

#3 Updated by John Abbott about 10 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

JAA thinks is would be too costly to change the Emacs code to handle this correctly (especially considering its low importance). I'm hoping that #481 concludes that multiline comments are to be banned -- that would automatically resolve this issue!

#4 Updated by John Abbott about 10 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 10 to 20

The simplest "solution" would be to document that the emacs UI does not handle multiline comments intelligently.

All should work OK if the multiline comment contains correct code (with the begin/end comment markers being on their own lines): e.g. like this

/*
Define f(n)
  Return n+1;
EndDefine; -- f
*/

Can we document this? (where?) And thus close the issue?

#5 Updated by Anna Maria Bigatti about 10 years ago

  • Target version set to CoCoA-5.1.0 Easter14

#6 Updated by John Abbott about 10 years ago

  • Target version changed from CoCoA-5.1.0 Easter14 to CoCoA-5.?.?

#7 Updated by John Abbott over 3 years ago

  • Target version changed from CoCoA-5.?.? to CoCoA-5.4.0

I suggest documenting this behaviour, and then closing this issue.

BUT where should it be documented?

Anna points out that multi-line comments trigger a warning (if the warning level is high enough).

#8 Updated by John Abbott about 3 years ago

  • Target version changed from CoCoA-5.4.0 to CoCoA-5.4.2

#9 Updated by John Abbott 3 months ago

  • Target version changed from CoCoA-5.4.2 to CoCoA-5.4.4

[2024-01-15] I have just confirmed that the bug is still there.
If the code is commented out with // or -- then Emacs recognises this correctly.
Also note that M-x comment-region does comment out using minus-minus.

Also available in: Atom PDF