2

I think emacs is just brilliant. The help functionality with C-h is extremely useful.

Recently, I started coding in SB Common Lisp.

It would be very useful if I could search the definitions of functions for common lisp also. I realise that this may not be a default feature. Is it possible?

Drew
  • 75,699
  • 9
  • 109
  • 225
Vinn
  • 263
  • 2
  • 7
  • https://emacs.stackexchange.com/tags/elisp/info – Drew Jul 25 '22 at 14:37
  • 1
    [slime mode](https://slime.common-lisp.dev/) provides support for browsing Lisp documentation from Emacs, as part of a suite of features for programming in Lisp. – Tyler Jul 25 '22 at 15:44

4 Answers4

2

One part of this puzzle to to get comfortable access to the Common Lisp HyperSpec. This snippet from my init explains how to get an info version with index:

      ;; Set up hyperspec lookup.  This is way more comfortable in
      ;; info-mode but takes a bit of setting up.  First get the tex files
      ;; from here: https://github.com/rebcabin/dpans2texi.  Then get a
      ;; patch to make things utf-8 friendly from here:
      ;; http://chalaev.com/f/emacs/dpans2texi.patch.  Apply the patch and
      ;; then ./configure; make; sudo make install.  You now have an info
      ;; version of the hyperspec with index (this is important).  We now
      ;; follow http://chalaev.com/emacs to make slime use this for
      ;; hyperspec lookup.  See the info-look stanza for getting info on
      ;; board. 

      ;; subvert slime doc lookup to use info
      (defvar slime-old-documentation-lookup-function
      (if (boundp 'slime-documentation-lookup-function)
        slime-documentation-lookup-function))

      (defun slime-ansicl-lookup (symbol-name)
       (interactive (list (slime-read-symbol-name "Symbol: ")))
       (info-lookup-symbol symbol-name 'lisp-mode))

      (setq slime-documentation-lookup-function 'slime-ansicl-lookup)
      (setq slime-ansicl-lookup (symbol-function 'slime-ansicl-lookup))
Fran Burstall
  • 3,665
  • 10
  • 18
1

Perhaps someone will answer that there's a 3rd-party package that helps with what you ask: interact with the Common Lisp doc using some C-h key(s). I'm not aware of any (but you can use eww to browse Common Lisp documentation on the web).

However, Emacs comes with library cl-lib.el, which provides Elisp functions etc. that to some extent emulate Common Lisp ones. The Elisp ones generally use the Common Lisp name but with prefix cl-. And Emacs provides a manual for this feature, GNU Emacs Common Lisp Emulation.

Unfortunately, the documentation of each cl- function etc. is very limited. Essentially, it typically just says that it emulates the Common Lisp function etc. So you often can't get much of a description.

And some Common Lisp functions etc. are not emulated. There is no cl-format function, for example - no emulation of Common Lisp format.

Drew
  • 75,699
  • 9
  • 109
  • 225
1

Package clhs provides a C-h binding option for looking up CL symbols in the CL HyperSpec: https://gitlab.com/sam-s/clhs

Phil Hudson
  • 1,651
  • 10
  • 13
0

Type M-x shortdoc-display-group, then pick a group, eg, string, and you'll get a help buffer with a short description and example for each function that operates on strings. Read more here.

However, it is about Elisp, not Common Lisp.

crocefisso
  • 1,141
  • 7
  • 15
  • 1
    OP asked about Common Lisp documentation, not Elisp. Please clarify how your post answers the question about Common Lisp. – Dan Jul 25 '22 at 14:39
  • 1
    I specified in my answer that the help buffer I mentioned was about Elisp, not Common Lisp. However I mentioned it as I thought it might help the Vinn, since ELisp is not so far from CLisp. – crocefisso Jul 25 '22 at 14:42
  • Maybe @Vinn could tell us if he really meant CLisp specifically and if a help buffer for Elisp is totally unuseful to him. – crocefisso Jul 25 '22 at 14:45
  • I mean common lisp. SBCL. Im clear on how to read about elisp within emacs – Vinn Jul 25 '22 at 16:34
  • Ok, sorry I think I misunderstood your question. – crocefisso Jul 25 '22 at 19:41