Doom-emacs: racket-doc is obsolete and doesn't work

Created on 17 Apr 2020  ·  19Comments  ·  Source: hlissner/doom-emacs

What did you expect to happen?
I expected racket-doc to provide me with nice Racket docs.
What actually happened?
I got an error - Wrong type argument: commandp, racket-doc.

racket-doc got replaced by other commands and doesn't work anymore - see https://github.com/greghendershott/racket-mode/issues/439

I think it would make the most sense to replace it with racket-xp-describe - seems more convenient for regular use than racket-xp-documentation.

Steps to reproduce:

  1. Open a Racket file
  2. Hit SPC m h

System information:


((emacs
(version . "26.3")
(features . "XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD LCMS2")
(build . "Aug 29, 2019")
(buildopts "--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now")
(windowsys . batch)
(daemonp . server-running))
(doom
(version . "2.0.9")
(build . "HEAD -> develop, origin/develop, origin/HEAD 65dacd101 2020-04-17 05:47:18 -0400")
(dir . "~/.doom.d/"))
(system
(type . gnu/linux)
(config . "x86_64-pc-linux-gnu")
(shell . "/bin/bash")
(uname . "Linux 5.4.31-1-MANJARO #1 SMP PREEMPT Wed Apr 8 10:25:32 UTC 2020 x86_64")
(path "~/.emacs.d/bin" "~/.local/bin" "/usr/local/bin" "/usr/bin" "/bin" "/usr/local/sbin" "/usr/lib/jvm/default/bin" "/usr/bin/site_perl" "/usr/bin/vendor_perl" "/usr/bin/core_perl" "/var/lib/snapd/snap/bin" "/usr/lib/emacs/26.3/x86_64-pc-linux-gnu"))
(config
(envfile . envvar-file)
(elc-files . 0)
(modules :completion company ivy :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup +defaults) pretty-code treemacs unicode vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold (format +onsave) snippets :emacs dired electric ibuffer undo vc :term vterm :checkers syntax :tools debugger (eval +overlay) lookup magit :lang data emacs-lisp markdown org racket sh :config (default +bindings +smartparens))
(packages "n/a")
(unpin "n/a")
(elpa "n/a")))

:lang racket update

All 19 comments

Does racket-visit-definition need to be replaced too?

People who upgrade from an older version of Racket Mode might be confused if they try to directly invoke one of the older commands: racket-doc, racket-describe, racket-visit-definition.

It’s one of the commands mentioned, so yep, seems like it. The functionality will be provided by a button in the racket-xp-describe buffer:

Also, at the bottom of the buffer are Emacs buttons – which you may navigate among using TAB, and activate using RET – for racket-visit-definition and racket-doc.

Hmm, I would much prefer a command that can jump-to-definition in one step, rather than two. We do have two distinct keys for them (gd = goto definition and K = look up in docs). Do you know what function/command that button triggers (if any)?

Oh, there is a racket-xp-visit-definition.

Okay, there is racket-xp-visit-definition which seems to be working. you beat me to it :)

For the documentation functionality I’d still use racket-xp-describe over racket-xp-documentation - the latter opens a web browser.

Agreed and understood! I'll make the change shortly. Thanks for looking into this and taking the time to let me know!

My pleasure! Thank you for working on Doom, it’s awesome and I really enjoy using it ☺️

@hlissner did you mean to change the keybinding SPC m h too? It currently is still bound to racket-doc: https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/racket/config.el#L40. Same for SPC m g d (racket-visit-definition).

Also, to get racket-xp* functions working, I think you need to enable the racket-xp-mode first. Not sure how you managed to get it working without the mode enabled...

@hlissner can you please reopen this? K and gd work, but SPC m h and SPC m g d are still useless. I can open a PR that would fix it - unless it's the desired behavior.

I can open a PR that would fix it

@sarna Please do.

@sarna: I intended to fix this, but didn't have time to do it (so feel free to!). FWIW, I think it should default to racket-repl-doc / racket-repl-describe, and when the feature +xp is provided, remap those to racket-xp-doc / racket-xp-describe. Thanks!

@sorawee Thanks for the suggestions! Did you mean racket-repl-visit-definition and racket-xp-visit-definition instead of describe though? gd stands for go to definition, I'm pretty sure :)

Yes! (well, I was thinking that there's racket-describe in the keymap, too, but that doesn't seem to be the case).

Perhaps you can reuse https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/racket/autoload.el#L25 for racket-*-visit-definition? And add a similar function for racket-*-doc?

@sorawee Haha I'm trying to do so right now, but I'm struggling a bit :)
Also, the naming is kind of confusing. As of now:
g d -> racket-*-visit-definition
K -> racket-*-describe
I thought about making SPC m g d behave like g d and SPC m h call racket-*-documentation. What do you think?

Yep, that's my preference as well :)

@sorawee I stumbled upon something weird - none of the keybindings from racket-mode-map are active in the REPL. +lookup/definition and +lookup/documentation are the default ones. Binding stuff directly to racket-repl-mode-map works though :thinking:
Can you please try to reproduce this so I know it's not just me? Like, write displayln in the REPL and hit K or gd. Or try to use any of the SPC m bindings.

Oh, I don't think the two mode maps are related to each other. If you want something to be available in both, I think you need to add to both of them. That being said, I feel visiting doc and definition don't have that great value in the REPL, since you are the one who enters the input, so you should already know what you are writing. My main use case for K and gd is on other people's code in the code buffer.

I thought racket-mode is like a “parent” mode for racket-xp-mode and racket-repl-mode 🤔

I’ll play around with it.

Was this page helpful?
0 / 5 - 0 ratings