# Adding a gutter to DrScheme

#lang scheme/gui
(require (lib "framework.ss" "framework")
(lib "etc.ss"))
(define f (new frame:basic% [label ""] [width 500] [height 600]))
(define hp (new horizontal-panel% [parent (send f get-area-container)]))
(define gutter-text (new scheme:text%))
(define gutter-ec (new editor-canvas%
[parent hp]
[style '(hide-vscroll)]
[editor gutter-text]
[stretchable-width #f]
[min-width 60]))
(define text (new scheme:text%))
(define ec (new editor-canvas% [parent hp] [editor text]))
(send text load-file (build-path (collection-path "drscheme")
"private" "rep.ss"))
(for-each
(λ (n) (send gutter-text insert (format "~a\n" n)))
(send gutter-ec scroll-to 0 0 0 0 #t)
(send f show #t)


## 4 thoughts on “Adding a gutter to DrScheme”

1. Luciano Ramalho says:

That’s a very useful hack, I wish I knew how to intall it in my DrScheme environment. Where should I put it?

2. Grant says:

Hi Luciano,

That code Robby provided is a starting point; it is his example of how one might add line numbers to the UI control.

The next step is to read up on writing “Tools” (aka plugins) for DrScheme and then writing a line number plugin.

Are you interested? :)

I have written one DrScheme tool, and overall it was a pleasant experience, that, for me scratched an important itch.

Line numbers are another one, I am just focused on a few other things right now.

3. paul says:

Hello ^^

i just looked for a tool how i can show line numbers in scheme and found your site ^^
the code above seems interesting, still it isnt the solution.
Did anyone here already made a Plug-In to see the line numbers? if yes, could you share it? :)
ty ^^

btw, maybe in my free time (aint gonna happen soon ^^) i will write it as a challenge, if nobody has written it yet.

4. Grant says:

Hi Paul:

It has not been made into a plug-in yet; in fact it has been waiting for you to appear and write it! If you do I would be happy to be a tester.

If you are looking for a Scheme editor that has line numbers you might also try Emacs; it has a line-number plug-in built-in.