reddit / emacs

C-h f equivalent in other languages

avindroth · 2022-04-29 04:48
I use selectrum and marginalia, and can find emacs-lisp functions really, really easily with them. I would like similar setup for other languages, namely common lisp (with slime). How would I go about achieving this? I tried installing helm-slime, but apropos command doesn't seem as snappy or functional as C-h f.
RentGreat8009 · 2022-04-29 10:23
http://snowsyn.net/2020/01/01/local-clhs-access-in-emacs/ If you want to learn CL, best guide is https://github.com/ashok-khanna/lisp-notes
avindroth · 2022-04-29 10:30
While the HyperSpec is great, I cannot access any functions in any of my packages. If I evaluate a defun in emacs, I can find it directly with C-h f, but I don't know how to do that with slime (other than helm-slime rn).
karthink · 2022-04-29 11:24
Unfortunately there's no uniform API for this provided by Emacs, so every coding environment supplies its own method and keybindings. - SLIME/Slynk (common lisps), Geiser (Schemes) and CIDER (Clojure): The `C-c C-d` prefix map has documentation options. I don't have these installed, but the `describe-function` equivalent looks something like `C-c C-d f`. - ESS (Emacs Speaks Statistics, for R and Julia): Again, the `C-c C-d` prefix map has documentation options. - LSP: `lsp-mode` and `eglot` both provide help-at-point functionality, the latter reuses `eldoc` for this. I'm not sure about look-ups like with `describe-function`.
RentGreat8009 · 2022-04-29 12:23
Try M-. and M-, (that's Meta dot and Meta comma). The former will take you to your source function and you can read the docstring there, and the latter will jump you back to where you came from. Does that help?
Phil-Hudson · 2022-04-30 10:44
Can't agree with your assessment of CLHS.
a-c-d-w · 2022-04-30 15:25
I feel like this could be a rich opportunity for a wrapper, `dwim`-style function that checks what mode you're in and dispatches to one of the documentation binds or describe-function ... whatever makes the most sense *in* that buffer. you could even do a definition in text-modes! I don't have a ton of time to work on this today, but I've stubbed out the beginnings of a package here: https://codeberg.org/acdw/lookup.el I mean like, literally beginnings. Just a Commentary: section in an empty file for now.
avindroth · 2022-05-01 08:56
This sounds excellent
a-c-d-w · 2022-05-01 15:24
:D Thanks --- I'm still stubbing out the functionality at the moment, so feel free to PR or open issues with ideas! These particular innards of Emacs I'm not too familiar with---I use them all the time, but I haven't read them.