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

Bad syntax highlighting of .lidr files #4799

Closed
nicolabotta opened this issue Dec 29, 2019 · 4 comments
Closed

Bad syntax highlighting of .lidr files #4799

nicolabotta opened this issue Dec 29, 2019 · 4 comments

Comments

@nicolabotta
Copy link

In idris-mode, syntax highlighting works fine on .idr files but on .lidr files (Bird style), I get something like this:

Screenshot_2019-12-29_15-31-02

At idris-hackers/idris-mode#506 (comment),
@david-christiansen suggests that this might be an Idris bug. Any idea how to fix the problem? Thanks, Nicola

@david-christiansen
Copy link
Contributor

In any case, the two disagree about the meaning of source positions!

The first place to check is whether the output from Idris is in fact correct. If not, it's probably source positions in the parser after the delit stage for lidr files. If so, then the Emacs mode probably has an obsolete hack that needs removing - see the highlight buffer on load bit.

@nicolabotta
Copy link
Author

David, I am afraid I do not understand any single bit of your comment. I guess this is fine, I am an Idris user, not a developer. I just would like to get a decent syntax highlighting in literate Idris files. This is what I use both for program development and for presentations. Cheers, Nicola

@fabianhjr
Copy link
Contributor

@nicolabotta, I closed #4478 in idris-dev since it was an issue with idris-mode and not the idris compiler/ide interface.

Check in idris-hackers/idris-mode#480 for more help. Apparently I had a configuration issue back then but it could have been a regression in your case.

@nicolabotta
Copy link
Author

@fabianhjr: Thanks for your feedback Fabian! There seem to be two problems with the current idris-mode: first, the function

(defun idris-highlight-column (idris-col)
  "Compute the Emacs position offset of the Idris column IDRIS-COL, for highlighting.                                     
                                                                                                                          
In particular, this takes bird tracks into account in literate Idris."
  (+ idris-col (if (idris-lidr-p) 1 -1)))

needs to be modified as suggested by andrewmcveigh in idris-hackers/idris-mode#480 as

(defun idris-highlight-column (idris-col)
  "Compute the Emacs position offset of the Idris column IDRIS-COL, for highlighting.                                     
                                                                                                                          
In particular, this takes bird tracks into account in literate Idris."
  (+ idris-col (if (idris-lidr-p) -1 -1)))

Second, the file in which this function is defined, idris-highlight-input.el, needs to be manually loaded. When idris-mode is loaded, this file is not loaded, for some reason.

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

No branches or pull requests

3 participants