From 3b5397c8dad34f9dfe83c2c44eeece0de9097df3 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 13 Apr 2013 05:22:20 +0200 Subject: A better solution to the funky filename problem So, the problem was that our regexp for a Racket prompt didn't take into account that filenames could contain white spaces: "@[^ ]*> ". A simple solution was accepting them: "@[^>]+> " won't work because '>' is also a valid character in filenames, so we went for "@.*> ". The drawback is that finding the beginning of the prompt (e.g. in C-a) fails when you're writing things like: racket@foo bar.rkt> (> 2 3) because here comint believes that the prompt is "racket@foo bar.rkt> (> " And that could have side-effects elsewhere. So what i've done is simply changing the way white-space is (not) printed in the prompt, substituting it by underscores. That way, whe can go back to the initial regexp, comint doesn't get confused, and users can easily infer that "@foo_bar.rkt>" is actually referring to their "foo bar.rkt" file. --- scheme/racket/geiser/user.rkt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scheme') diff --git a/scheme/racket/geiser/user.rkt b/scheme/racket/geiser/user.rkt index aef1862..b7519b2 100644 --- a/scheme/racket/geiser/user.rkt +++ b/scheme/racket/geiser/user.rkt @@ -1,6 +1,6 @@ ;;; user.rkt -- global bindings visible to geiser users -;; Copyright (C) 2010, 2011, 2012 Jose Antonio Ortega Ruiz +;; Copyright (C) 2010, 2011, 2012, 2013 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -87,8 +87,8 @@ (define geiser-prompt (lambda () - (printf "racket@~a> " - (namespace->module-name (current-namespace) (last-entered))))) + (let ([m (namespace->module-name (current-namespace) (last-entered))]) + (printf "racket@~a> " (regexp-replace* " " m "_"))))) (define (geiser-prompt-read prompt) (make-repl-reader (geiser-read prompt))) -- cgit v1.2.3