racket-mode icon indicating copy to clipboard operation
racket-mode copied to clipboard

scribble support?

Open dented42 opened this issue 11 years ago • 4 comments

racket-mode doesn't seem to understand scribble files very well. It would be nice to have Emacs commands for rendering the current buffer to an plain-text, markdown, html, latex, or pdf document. This would also require being able to parse at-exprs correctly, which would mean racket mode would by default be able to parse '#lang at-exp racket' and friends.

I think having racket-mode be able to theoretically support any reader extension is most likely overkill, but support for common ones such as at-expressions, the typed racket annotations (#{a : B} and friends), and scribble would be nice.

dented42 avatar Nov 30 '14 03:11 dented42

Have you tried Neil van Dyke's scribble-mode? (See also a GitHub fork.) I'm curious to know what you think about it.

It would be nice to have Emacs commands for rendering the current buffer to an plain-text, markdown, html, latex, or pdf document.

Yes, that sounds like it would be handy.

This would also require being able to parse at-exprs correctly, which would mean racket mode would by default be able to parse '#lang at-exp racket' and friends.

I think having racket-mode be able to theoretically support any reader extension is most likely overkill, but support for common ones such as at-expressions, the typed racket annotations (#{a : B} and friends), and scribble would be nice.

Can you say more about these, because I'm not sure specifically what you're interested in? For example I routinely use at-exps in .rkt files with racket-mode, and I've occasionally used TR annotations, and things have worked as I expected. Please help me understand what you'd like to work better?

I think having racket-mode be able to theoretically support any reader extension is most likely overkill

Having racket-mode fully support any/every Racket #lang would be ideal. Last I checked, I got the impression that the mechanisms to help DrRacket do that presume a fully Racket GUI editor environment. However my impression might be wrong. Also I've learned more about making Racket and Emacs work together. So it would be interesting to take another look at this when I have time.

greghendershott avatar Nov 30 '14 04:11 greghendershott

I haven't tried scribble-mode. It doesn't look like it knows much about racket, it's syntax highlighting seems to be regex based. Other than that it seems nice, and what one would expect of an Emacs mode that doesn't collaborate with the language being interpreted to find things out about the contents of a buffer.

As far as at-exprs go, after I saw your comment I played around and M-. and the rest of the racket-mode goodies seem to work as expected. I'm a little embarrassed to say that I didn't look very deep, I just opened a scribble file in racket-mode, noticed that the identifier between the @ and the brace/bracket was black instead of being highlighted like an identifier, which just made me assume that it didn't deal with at-exprs at all, it's clear I was wrong, though perhaps some way to detect if at-exprs are being used based on the #lang so that correctly rendering them can be turned on and off.

I was mainly interested in at-exprs, to be honest. I just included TR-annotations as something similar that could possible be solved the same way. It just seems to me that supporting all the custom readers that are available in a fresh install of racket might not be a bad milestone? I'm not aware of them being handled improperly, I just assumed they would each require a modification of the racket-mode parsing functions.

Support for every #lang would be brilliant, I suppose the ideal way of doing that would be to refactor DrRacket into the GUI bit and a library for handling all the text-analysing things that an IDE might want to do. But that seems a long way off.

dented42 avatar Dec 01 '14 01:12 dented42

Little late to this, and hopefully not too off-topic, but is there a list somewhere of every #lang? I'm attempting to use Emacs to go through HTDP, and after an hour+ of fruitless searching, finally tweeted to #racketlang about how to use the beginning student language in emacs. ( #lang htdp/bsl )

Knowing what's definable in #lang seems helpful (if not completely within racket-mode's wheelhouse).

cena avatar Apr 15 '15 14:04 cena

is there a list somewhere of every #lang?

This is a great question. It might be good to raise on StackOverflow and/or racket-users.

I think the answer is to navigate all installed collections, and see which ones provide a lang/reader.

how to use the beginning student language in emacs. ( #lang htdp/bsl )

I'm not familiar at all with the various students languages.

I did just try doing the following in racket-mode and it worked:

#lang htdp/bsl
(+ 1 1)

But if you have any problems feel free to log a fresh issue for each one, here.

greghendershott avatar Apr 15 '15 14:04 greghendershott