Project

General

Profile

Bug #1325

Emacs UI: emacs does not recognize "until" as marking the end of a "repeat" block

Added by John Abbott over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
EmacsUI
Target version:
Start date:
01 Oct 2019
Due date:
% Done:

100%

Estimated time:
1.51 h
Spent time:

Description

When typing in code into a CoCoA-5 buffer, emacs does not recognise that the keyword until as marking the end of a repeat block.
So if I then try to use C-c C-e to close another block (e.g. fn defn) then emacs's block nesting code thinks the repeat block is still open,
and all other blocks are then off-by-one.

History

#1 Updated by John Abbott over 4 years ago

Here is a test case:

define john(n)
  ans := 0;
  repeat
     ans := ans + 1;
     n := n-1;
  until n < 0;
  return ans;
[[now ask Emacs to end the function C-c C-e]]

#2 Updated by John Abbott over 4 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 80

I think I may have solved this (without actually understanding what the emacs-lisp code does).

I have changed the definition of cocoa5-endkeywords-list so that it recognizes until and Until as end-keywords.
A quick test suggests that this works OK.

As far as I can see the emacs UI is quite simplistic, and will not indicate any problem if the start and end keywords do not match (e.g. if blah blah endwhile is regarded as an opened-and-closed block).

#3 Updated by John Abbott over 4 years ago

  • Assignee set to John Abbott

I now see that in cocoa5.el there are two very similar constants: cocoa5-endkeywords-list and cocoa5-end-block-re.
The only differences between them that I can see is that cocoa5-end-block-re includes until while the other does not, and cocoa5-end-block-re matches only whole words (i.e. it matches only inside \< and \>).

It looks like *cocoa5-autoindent-lines-re contains considerable redundancy because it contains both cocoa5-endkeywords-list and cocoa5-noindent-re; probably we can remove cocoa5-endkeywords-list from it.

There is similar redundancy around line 376 in the very long definition of cocoa5-font-lock-keywords.

#4 Updated by John Abbott over 4 years ago

  • Status changed from Resolved to Feedback
  • % Done changed from 80 to 90
  • Estimated time set to 1.44 h

I have made the changes which I think are right for having until recognized as an end-keyword.
I have tried to clean up the "self-documenting" code a bit, and hope that I've done the right changes.

Some simple tests pass. CVS-ed. Hoping Anna will also check this revised version.

#5 Updated by Anna Maria Bigatti over 4 years ago

  • Status changed from Feedback to Closed
  • Target version changed from CoCoA-5.4.0 to CoCoA-5.3.0
  • % Done changed from 90 to 100
  • Estimated time changed from 1.44 h to 1.51 h

tried. works. closed.

Also available in: Atom PDF