Closed arademaker closed 4 years ago
Hmm. These catch my eye:
(racket--el-source-dir UNDEFINED)
(racket--rkt-source-dir UNDEFINED)
Normally these values are strings that are pathnames -- dirs under load-file-name
:
(defconst racket--el-source-dir
(file-name-directory (or load-file-name (racket--buffer-file-name)))
"Path to dir of our Emacs Lisp source files.
When installed as a package, this can be found from the variable
`load-file-name'. When developing interactively, get it from the
.el buffer file name.")
(defconst racket--rkt-source-dir
(expand-file-name "./racket/" racket--el-source-dir)
"Path to dir of our Racket source files. ")
So for example if you installed Racket Mode from MELPA, racket--el-source-dir
would be a string like (say) "/Users/ar/.emacs.d/elpa/racket-mode-20200509.1405"
. I don't understand how it would instead be the symbol 'UNDEFINED
.
How did you install Racket Mode?
MELPA, I believe! I have in my init.el:
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
(package-initialize)
Yes, that looks like MELPA.
Could you please:
C-h v and enter racket--run.rkt
(note the double hyphens --
): What is the value?
C-h v and enter racket-adjust-run-rkt
: What is the value?
Also, is this your first time using Racket Mode? OR, did you update the package recently -- and if so did it used to work but stopped, now?
racket--run\.rkt is a variable defined in ‘racket-cmd.el’.
Its value is
"/Users/ar/.emacs.d/elpa/racket-mode-20200509.1405/racket/main.rkt"
Documentation:
Pathname of run.rkt.
racket-adjust-run-rkt is a variable defined in ‘racket-cmd.el’.
Its value is ‘identity’
Documentation:
A function used to transform the variable ‘racket--run.rkt’.
You probably don’t need to change this unless you are developing
Racket Mode, AND run Emacs on Windows Subsystem for Linux, AND
want to run your programs using Windows Racket.exe, AND have the
Racket Mode source code under "/mnt". Whew. In that case you
can set this variable to the function ‘racket-wsl-to-windows’ so
that Racket Mode can find its own run.rkt file.
No. I have used before and I was able to run the repl. But I don't use it very ofen, so probably I have updated the packages more than one time before notice the error.
Does /Users/ar/.emacs.d/elpa/racket-mode-20200509.1405/racket/main.rkt
exist?
(The value of racket--run.rkt
is based on racket--rkt-source-dir
. So if the latter is 'UNDEFINED
I'm confused how the former could be /Users/ar/.emacs.d/elpa/racket-mode-20200509.1405/racket/main.rkt
. But however it got that value, it seems like a reasonable value. So I'd just like to confirm that, to narrow down the possibility tree.)
Also, it might be worth trying this. I realize it's a PITA, and often it's not needed. But since things seems to be in such a mysterious (to me) state, it's probably warranted?
Yes.
% file /Users/ar/.emacs.d/elpa/racket-mode-20200509.1405/racket/main.rkt
/Users/ar/.emacs.d/elpa/racket-mode-20200509.1405/racket/main.rkt: ASCII text
Done, I removed the package, restarted Emacs, installed the package again. Same behaviour.... C-c C-z does not start the repl.
Interesting.
What if you M-x racket-start-back-end
? Do you see any error message? How about in the *Messages*
buffer (just in case the message didn't appear in the echo area for some reason).
Something else to try:
M-x racket-logger
. A *Racket Logger*
buffer should appear.
Type l
.
Enter racket-mode
for the topic.
Enter debug
for the level.
Now try again to M-x racket-repl
. Please copy that tail end of the *Racket Logger*
buffer, and paste it here.
Thank you!
Hi @greghendershott , thank you very much for your attention. After step 1, I got the screen attached below
Note that l
didn't give me the option racket-mode
in the list. What should I do from here?
It should allow you to type something new, not already on the list. Can you type racket-mode
and ENTER?
If it doesn't allow you to type something new, then that's a separate issue I'll investigate! :smile: It definitely does for me. Anyway, in that case, perhaps you could M-x customize-mode
, and among the Racket options choose Other
, choose Logger Configuration
, and INS
a new racket-mode
item with the value debug
.
I guess you could also just M-x eval-expression
and enter (add-to-list 'racket-logger-config '(racket-mode . debug))
for a one-time thing.
OK, I have added racket-mode
with value debug
using the customize-mode. I have also checked the value of racket-logger-config
:
((cm-accomplice . warning) (GC . info) (module-prefetch . warning) (optimizer . info) (racket/contract . error) (sequence-specialization . info) (* . fatal) (racket-mode . debug))
But in the *Racket Logger*
I didn't see any change once I call M-x racket-repl
. The content is:
racket-logger-config:
((cm-accomplice . warning)
(GC . info)
(module-prefetch . warning)
(optimizer . info)
(racket/contract . error)
(sequence-specialization . info)
(* . fatal)
(racket-mode . debug))
racket-logger-config:
((cm-accomplice . warning)
(GC . info)
(module-prefetch . warning)
(optimizer . info)
(racket/contract . error)
(sequence-specialization . info)
(* . fatal)
(racket-mode . debug))
OK, well that in itself is interesting information. What we seem to know now:
Despite the bizarre 'UNDEFINED
values in racket--el-source-dir
and racket--rkt-source-dir
, the correct path to /Users/ar/.emacs.d/elpa/racket-mode-20200509.1405/racket/main.rkt
is being used to try to start the back end process, and it exists.
The back end process is running. Otherwise when you did M-x racket-start-back-end
, you would have seen an error message.
When you do M-x racket-repl
, the back end does not receive the command. You have no logger output. Whereas I see something like this:
racket-logger-config:
((racket-mode-syntax-cache . debug)
(TR-optimizer . info)
(racket-mode . debug)
(cm-accomplice . warning)
(GC . info)
(module-prefetch . warning)
(optimizer . warning)
(racket/contract . error)
(sequence-specialization . info)
(* . fatal))
[ info] racket-mode: TCP port 39241 chosen for REPL sessions
[ info] racket-mode: '(1427 "*" (repl-tcp-port-number))
[ debug] racket-mode: (call-with-session-context '() #<procedure:command> '((repl-tcp-port-number))): no specific session
[ info] racket-mode: start "repl-session-0"
[ debug] racket-mode: (set-session! "repl-session-0" #f #f) => sessions: (hash "repl-session-0" (session #<thread:repl-thunk> #<channel> #f #<namespace> #f))
[ debug] racket-mode: (set-session! "repl-session-0" #f #f) => sessions: (hash "repl-session-0" (session #<thread:repl-thunk> #<channel> #f #<namespace> #f))
[ info] racket-mode: '(1428 "repl-session-0" (syms))
[ debug] racket-mode: (call-with-session-context "repl-session-0" #<procedure:command> '((syms))) => (session #<thread:repl-thunk> #<channel> #f #<namespace> #f)
[ info] racket-mode: '(1429 "repl-session-0" (break terminate))
Next: While you have the racket-mode
logger topic set to debug
, please try M-x racket-start-back-end
again, and tell me the logger output? Thank you!
(Note: M-x racket-start-back-end
is really "restart". If back end already running, it will be stopped and started again. So you should see some logger output. If you still don't, that will be the interesting fact for me to consider.)
(Note: Normally things you do in Racket Mode will start the back end automatically. That's why I haven't documented the racket-start-back-end
and racket-stop-back-end
commands. In a happy world you wouldn't need to use them.)
One other idea: It is rare but possible there might be stderr
output that the logger would not (or could not) show. To check for this, switch to the buffer " *racket-process-stderr*"
. The leading space in the buffer name is important. This tells Emacs to hide the buffer from normal pick-a-buffer lists. You'll need to type that buffer name, including the leading space. If you have trouble switching to this buffer, let me know. Anyway, there might be some useful output, there.
If you see any content in that buffer other than Process racket-process stderr finished
, please let me know? (After trying commands like M-x racket-start-back-end
and M-x racket-repl
.) Thanks!
I see nothing in the logger when I execute M-x racket-start-back-end
In the *racket-process-stderr*
I see
standard-module-name-resolver: collection not found
for module path: gui-debugger/marks
collection: "gui-debugger"
in collection directories:
/Users/ar/Library/Racket/7.6/collects
/usr/local/Cellar/minimal-racket/7.6/share/racket/collects
context...:
show-collection-err
standard-module-name-resolver
module-path-index-resolve
perform-require!
for-loop
finish
[repeats 2 more times]
pass-1-and-2-loop
module-begin-k
expand-module
expand-capturing-lifts
temp98_0
temp71_0
compile
temp65_0
standard-module-name-resolver
...
Process racket-process stderr finished
standard-module-name-resolver: collection not found
for module path: gui-debugger/marks
collection: "gui-debugger"
in collection directories:
/Users/ar/Library/Racket/7.6/collects
/usr/local/Cellar/minimal-racket/7.6/share/racket/collects
context...:
show-collection-err
standard-module-name-resolver
module-path-index-resolve
perform-require!
for-loop
finish
[repeats 2 more times]
pass-1-and-2-loop
module-begin-k
expand-module
expand-capturing-lifts
temp98_0
temp71_0
compile
temp65_0
standard-module-name-resolver
...
Process racket-process stderr finished
standard-module-name-resolver: collection not found
for module path: gui-debugger/marks
collection: "gui-debugger"
in collection directories:
/Users/ar/Library/Racket/7.6/collects
/usr/local/Cellar/minimal-racket/7.6/share/racket/collects
context...:
show-collection-err
standard-module-name-resolver
module-path-index-resolve
perform-require!
for-loop
finish
[repeats 2 more times]
pass-1-and-2-loop
module-begin-k
expand-module
expand-capturing-lifts
temp98_0
temp71_0
compile
temp65_0
standard-module-name-resolver
...
Process racket-process stderr finished
standard-module-name-resolver: collection not found
for module path: gui-debugger/marks
collection: "gui-debugger"
in collection directories:
/Users/ar/Library/Racket/7.6/collects
/usr/local/Cellar/minimal-racket/7.6/share/racket/collects
context...:
show-collection-err
standard-module-name-resolver
module-path-index-resolve
perform-require!
for-loop
finish
[repeats 2 more times]
pass-1-and-2-loop
module-begin-k
expand-module
expand-capturing-lifts
temp98_0
temp71_0
compile
temp65_0
standard-module-name-resolver
...
Process racket-process stderr finished
It is strange because, from the prompt, I can start Racket normally:
ar@leme ~ % which racket
/usr/local/bin/racket
ar@leme ~ % racket
Welcome to Racket v7.6.
>
Calling the same rkt file I don't have any error too:
ar@leme main % racket ex-1.15.rkt
ar@leme main %
In the buffer *racket-process*
I see
Process racket-process exited abnormally with code 1
Process racket-process exited abnormally with code 1
Process racket-process exited abnormally with code 1
Process racket-process exited abnormally with code 1
While I was waiting for you to reply, I realized that I should "surface" any stderr output to make this kind of investigation easier for folks like you (and me). :smile: So I have a commit (not yet merged), to display the stderr buffer automatically when it receives output.
The error is that the back end Racket Mode program is trying to use the collection, gui-debugger/marks
. Probably this information about using Minimal Racket applies -- does doing a raco pkg install drracket
resolve it for you?
Wow!! Finally I got the REPL. It looks like the raco pkg install drracket
was the missing step!
Now I will try to understand how to uninstall the DrRacket from my Applications folder that I installed from https://download.racket-lang.org/racket-v7.6.html. The ideia is to keep only the instalation from the brew. Actually, I was expecting that the raco command above would also give me the DrRacket IDE, but that is not the case, right ? I didn't find in my path the DrRacket command. But ok, I can now live in Emacs with racket-mode! ;-)
Yay! :tada:
I'm sorry that Racket Mode startup fails this way, so silently. As I mentioned above, I'm already working on making it fail more noisily.
I'm not sure if installing the drracket
package installs the DrRacket application. But I'm also not sure how much more space the app would really add, compared to all the libraries? In that vein...
The drracket
package has dependencies that Racket Mode doesn't need. I suggest installing it as a simple, one-line, reliable thing to do.
I'll investigate the minimal actual dependencies. Then I'll update the docs.
Also, I'll look into checking the deps installed on startup, and a message repeating how to install. Maybe I'll even offer to run raco pkg install
, to do it.
I'll create those to-do items as separate issues, in case you want to close this one (unless you have more questions/problems).
p.s. Thank you for being so patient and including such great information and screen caps!
I'm going to close this because:
I think I've addressed the core problem of it silently failing to start.
I also opened a new issue #471 to look at ways to improve the dependency on the drracket
package.
If you disagree, please feel free to re-open, and/or add more comments here.
I still had this problem on my ubuntu. raco pkg install drracket
- I missed that totally. Thank you a lot!
C-c C-z doesn't start the repl. The command M-x racket-repl doesn't start the repl... No error message..