Re: [racket-dev] Bug in the documentation or the implementation

2012-03-19 Thread Robby Findler
[ re-added the dev mailing list ]

On Mon, Mar 19, 2012 at 7:44 AM, Antonio Menezes Leitao
 wrote:
> Hi Robby,
>
> On Mon, Mar 19, 2012 at 12:00 PM, Robby Findler
>  wrote:
>> I'm not able to reproduce this problem. I created a file, copied and
>> pasted the code from 3.3.9 in the DrRacket docs into the file,
>> selected the "Add User-defined Keybindings" menu item, chose the file,
>> and got no error. The keybindings also seem to work, I tried them with
>> this file:
>>
>> #lang racket/base
>> (+ 1 2)
>>
>> I selected the (+ 1 2) and typed control-c control-r and saw it appear
>> in the REPL.
>>
>> Are you doing something differently?
>
> I did the same thing, except that I restarted
> DrRacket after installing the keybindings. Quitting and
> starting again gives the following error on startup:
>
> Error when installing the keybindings F:\Users\aml\Desktop\keys.rkt:
>
> link: reference (phase 0) to a variable in module "C:\Program
> Files\Racket\collects\drracket\tool-lib.rkt" that is uninitialized
> (phase level 0); reference appears in module:
> "F:\Users\aml\Desktop\keys.rkt" in: drracket:unit:definitions-text<%>
>
> Did you try restarting DrRacket?

I didn't! Thanks, that's what I was missing.

> Ps: There is also a less serious error when invoking
> Ctrl-c Ctrl-e with the cursor _after_ the expression:
>
> Error running keybinding ...Desktop\keys.rkt:5:22
>
> send-range-to-repl: contract violation, expected:
> exact-positive-integer?, given: #f
>  contract from: (function send-range-to-repl), blaming:
> F:\Users\aml\Desktop\keys.rkt
>  contract:
>    (->
>     (is-a?/c interface:unit:definitions-text<%>)
>     exact-positive-integer?
>     exact-positive-integer?
>     boolean?
>     any)
>  at: F:\Users\aml\Desktop\keys.rkt:33.18

I've pushed a fix for both of these. If you don't want to deal with
git and whatnot (altho we've tried to make this easy and there are
nightly builds), then below is the relevant portion of the diff that
you can apply to get the main part of the fix (the line numbers may be
slightly different).

Thanks again!

Robby

diff --git a/collects/drracket/private/main.rkt
b/collects/drracket/private/main.rkt
index cc979bc..16b18c0 100644
--- a/collects/drracket/private/main.rkt
+++ b/collects/drracket/private/main.rkt
@@ -702,10 +702,6 @@
 ;;   not going to be exiting yet.
 (autosave:restore-autosave-files/gui)

-;; install user's keybindings
-(for-each drracket:frame:add-keybindings-item
-  (preferences:get 'drracket:user-defined-keybindings))
-
 ;; the initial window doesn't set the
 ;; unit object's state correctly, yet.
 (define (make-basic)
@@ -727,9 +723,12 @@
 (loop (cdr files))
 (cons (car files) (loop (cdr files])))


 (queue-callback
  (λ ()
+
+   ;; install user's keybindings
+   (for-each drracket:frame:add-keybindings-item
+ (preferences:get 'drracket:user-defined-keybindings))
+
;; NOTE: drscheme-normal.rkt sets current-command-line-arguments to
;; the list of files to open, after parsing out flags like -h
(let* ([files-to-open

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Bug in the documentation or the implementation

2012-03-19 Thread Robby Findler
I'm not able to reproduce this problem. I created a file, copied and
pasted the code from 3.3.9 in the DrRacket docs into the file,
selected the "Add User-defined Keybindings" menu item, chose the file,
and got no error. The keybindings also seem to work, I tried them with
this file:

#lang racket/base
(+ 1 2)

I selected the (+ 1 2) and typed control-c control-r and saw it appear
in the REPL.

Are you doing something differently?

Did the contents of your file get garbled, possibly?

Robby

On Mon, Mar 19, 2012 at 6:00 AM, Antonio Menezes Leitao
 wrote:
> Hi,
>
> Was there any progress regarding this problem?
> It seems that the bug is still present in the current
> (5.2.1) version.
>
> Best regards,
> António.
>
> On Tue, Feb 7, 2012 at 9:35 AM, Antonio Menezes Leitao
>  wrote:
>> Hi,
>>
>> The example provided in section 3.3.9 of the documentation
>> "Dr Racket: The Racket Programming Environment" doesn't
>> work in Racket version 2.1.3.  It reports the error:
>>
>> Error when installing the keybindings
>> C:\Users\aml\Desktop\racket-keybinding.rkt:
>>
>> link: reference (phase 0) to a variable in module "C:\Program
>> Files\Racket\collects\drracket\tool-lib.rkt" that is uninitialized
>> (phase level 0); reference appears in module:
>> "C:\Users\aml\Desktop\racket-keybinding.rkt" in:
>> drracket:unit:definitions-text<%>
>>
>> Best,
>> António.
>
> _
>  Racket Developers list:
>  http://lists.racket-lang.org/dev

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Bug in the documentation or the implementation

2012-03-19 Thread Antonio Menezes Leitao
Hi,

Was there any progress regarding this problem?
It seems that the bug is still present in the current
(5.2.1) version.

Best regards,
António.

On Tue, Feb 7, 2012 at 9:35 AM, Antonio Menezes Leitao
 wrote:
> Hi,
>
> The example provided in section 3.3.9 of the documentation
> "Dr Racket: The Racket Programming Environment" doesn't
> work in Racket version 2.1.3.  It reports the error:
>
> Error when installing the keybindings
> C:\Users\aml\Desktop\racket-keybinding.rkt:
>
> link: reference (phase 0) to a variable in module "C:\Program
> Files\Racket\collects\drracket\tool-lib.rkt" that is uninitialized
> (phase level 0); reference appears in module:
> "C:\Users\aml\Desktop\racket-keybinding.rkt" in:
> drracket:unit:definitions-text<%>
>
> Best,
> António.

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] Bug in the documentation or the implementation

2012-02-07 Thread Antonio Menezes Leitao
Hi,

The example provided in section 3.3.9 of the documentation
"Dr Racket: The Racket Programming Environment" doesn't
work in Racket version 2.1.3.  It reports the error:

Error when installing the keybindings
C:\Users\aml\Desktop\racket-keybinding.rkt:

link: reference (phase 0) to a variable in module "C:\Program
Files\Racket\collects\drracket\tool-lib.rkt" that is uninitialized
(phase level 0); reference appears in module:
"C:\Users\aml\Desktop\racket-keybinding.rkt" in:
drracket:unit:definitions-text<%>

Best,
António.

_
  Racket Developers list:
  http://lists.racket-lang.org/dev