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?

2

4 Answers 4

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))
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.

1

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

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.

5
  • 1
    OP asked about Common Lisp documentation, not Elisp. Please clarify how your post answers the question about Common Lisp.
    – Dan
    Commented Jul 25, 2022 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
    Commented Jul 25, 2022 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
    Commented Jul 25, 2022 at 14:45
  • I mean common lisp. SBCL. Im clear on how to read about elisp within emacs
    – Vinn
    Commented Jul 25, 2022 at 16:34
  • Ok, sorry I think I misunderstood your question.
    – crocefisso
    Commented Jul 25, 2022 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.