Re: [racket-users] Export indentation preferences in a package's info.rkt?

2015-08-12 Thread Alexis King
IMO, the truly Racket-y way would be to attach a syntax property to the 
exported identifier that has information about how it should be indented. This 
is actually a major improvement over the current way DrRacket handles 
indentation because it would handle forms by their syntactic binding rather 
than by datums. That means that:

  1. Multiple forms could have the same “name” and have different indentation.
  2. Forms imported with rename-in, prefix-in, etc. would be indented properly.
  3. Indentation settings come from the forms themselves rather than some
 unrelated configuration settings.

I think all of those things are big wins over datum-based configuration. 
However, the obvious problem is that it means bindings need to be resolved 
before indentation settings can be retrieved since the binding needs to be 
resolved to access its syntax properties.

In DrRacket, I wonder if this could work similarly to the recent improvement to 
blueboxes: IIUC, they work by binding now, but they perform some 
caching/guessing so that documentation can still be resolved before background 
expansion finishes. Leveraging the same technique would probably work for 
indentation information.

Alexis

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Export indentation preferences in a package's info.rkt?

2015-08-12 Thread Robby Findler
I agree this would be nice but I think the right way to approach it would
be to have metadata cached (via some more generic library supporting such
metadata) with exported libraries in a file near the .zo and .dep files.
Then drracket can figure out what is imported and then read those files for
things like indentation. And, of course, there are likely to be other uses
of such metadata.

Robby

On Wednesday, August 12, 2015, Alexis King lexi.lam...@gmail.com wrote:

 IMO, the truly Racket-y way would be to attach a syntax property to the
 exported identifier that has information about how it should be indented.
 This is actually a major improvement over the current way DrRacket handles
 indentation because it would handle forms by their syntactic binding rather
 than by datums. That means that:

   1. Multiple forms could have the same “name” and have different
 indentation.
   2. Forms imported with rename-in, prefix-in, etc. would be indented
 properly.
   3. Indentation settings come from the forms themselves rather than some
  unrelated configuration settings.

 I think all of those things are big wins over datum-based configuration.
 However, the obvious problem is that it means bindings need to be resolved
 before indentation settings can be retrieved since the binding needs to be
 resolved to access its syntax properties.

 In DrRacket, I wonder if this could work similarly to the recent
 improvement to blueboxes: IIUC, they work by binding now, but they perform
 some caching/guessing so that documentation can still be resolved before
 background expansion finishes. Leveraging the same technique would probably
 work for indentation information.

 Alexis

 --
 You received this message because you are subscribed to the Google Groups
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to racket-users+unsubscr...@googlegroups.com javascript:;.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Export indentation preferences in a package's info.rkt?

2015-08-11 Thread Greg Hendershott
In Emacs:

- Emacs Lisp (Elisp) macros can use a `declare` form to attach
metadata, including indentation info:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Declare-Form.html

- Other (external) Lisp language modes have a convention that there's
an Elisp {lisp,scheme,racket}-indent-function that does indentation,
and, it looks for a property list, where the key is the name of a
macro and the value is usually a number. Users can at least tweak this
in their Emacs init file. For example for racket-mode:

  
https://github.com/greghendershott/racket-mode/blob/master/Reference.md#racket-indent-line

For Racket:

- I like the idea of collections being able to provide indentation
info for special forms.

- I'd like the info to be easily accessible to both DrRacket and other
tools (including but not limited to racket-mode :)).

- Off the top of my head, it doesn't seem very Rackety to give
functions a runtime blob of metadata.

- Probably a more Rackety way to do this would be in a submodule. Much
like doc, indentation info feels like something that's not about run
time (or even compile time).  Doc is about doc time, and indentation
is about edit time (or tool time).

Also, like doc, there's an xref database aspect to this -- given a
namespace and a symbol foo, you want to quickly lookup the indentation
for the correct foo.  In fact, maybe doc time vs. edit time is a
distinction without a difference. Maybe the answer is to allow docs to
be more structured -- such as, instead of a blob of HTML, here's the
blue box part, here's the remaining part, here's the (optional, new)
indentation value, and so on.  [It could still be a blob of HTML, I
guess -- just one tagged more finely ala so-called semantic HTML.]

Sorry that turned into a longer ramble than I expected.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Export indentation preferences in a package's info.rkt?

2015-08-09 Thread Jack Firth
I find it irritating when I have to repeatedly add various macros exported by 
libraries to their proper group in the Indenting section of DrRacket's settings 
so that they're properly formatted. Is there a way for a package's info.rkt to 
specify default indentation preferences for it's macros for DrRacket to make 
sense of? If not, would that be something easy enough to do and useful enough 
to be worth doing?

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Export indentation preferences in a package's info.rkt?

2015-08-09 Thread Alexander D. Knauth
I would really like to have such a feature.  

On Aug 9, 2015, at 1:23 PM, Jack Firth jackhfi...@gmail.com wrote:

 I find it irritating when I have to repeatedly add various macros exported by 
 libraries to their proper group in the Indenting section of DrRacket's 
 settings so that they're properly formatted. Is there a way for a package's 
 info.rkt to specify default indentation preferences for it's macros for 
 DrRacket to make sense of? If not, would that be something easy enough to do 
 and useful enough to be worth doing?
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.