Viewing the Common Lisp HyperSpec offline via Emacs
Asked Answered
M

2

6

I'm using Emacs as my Lisp environment, and would like to have offline access to the Common Lisp HyperSpec. I downloaded it, and put the folders into my emacs.d directory. I then put the following code into my .emacs:

(global-set-key [(f2)] 'slime-hyperspec-lookup) 
(setq common-lisp-hyperspec-root "/.emacs.d/HyperSpec/")

However, every time I try to search for something in it, my query ends up being malformed. Specifically, suppose I search for dotimes; what gets dumped into my browser is file:///.emacs.d/HyperSpec/Body/m_dolist.htm, which doesn't match the directory structure in the HyperSpec folder, causing the query to fail. The HyperSpec lookup instead formats to suit the web version (in that case, it works absolutely fine).

Is there any way I can fix this, and if so, how? I basically just want to be able to look up the HyperSpec even when I'm not online.

Morgue answered 15/5, 2014 at 10:52 Comment(2)
You say you placed the HyperSpec into your .emacs.d, is your .emacs.d. in the system root, as you've entered here, or should your path in the setq be ~/.emacs.d/HyperSpec/ ? Or was this maybe a typo in forming the question?Miterwort
Possible duplicate of Is there any common lisp docs like linux man?Indifferent
I
5

Please replace

(setq common-lisp-hyperspec-root "/.emacs.d/HyperSpec/")

with

(setq common-lisp-hyperspec-root "~/.emacs.d/HyperSpec/")

or even

(setq common-lisp-hyperspec-root (expand-file-name "~/.emacs.d/HyperSpec/"))
Indifferent answered 15/5, 2014 at 16:11 Comment(0)
G
14

You might like to try my CLHS ASDF wrapper, which is specifically designed to download the CLHS into a standard location (basically the quicklisp directory) and then help you setup emacs to point to it.

Simply invoke (ql:quickload "clhs") and follow the instructions.

Hope this helps!


edit: @JigarParekh I think you may have skimmed my answer a little too fast.

The question's title is "Viewing the Common Lisp HyperSpec offline via Emacs". The question's body basically gets bogged down in the details of manually installing the CLHS and pointing emacs to it, and asks how to solve an immediate subproblem related to that. The selected answer solves the user's immediate subproblem, but is less than optimal given what's available today.

My answer does include the essential part of the answer, which is:

Simply invoke (ql:quickload "clhs") and follow the instructions.

This downloads the CLHS from Quicklisp in a way that should remain available for the foreseeable future, regardless of the helpful but optional additional information I included for reference in the first paragraph. My answer would remain useful even if the reference links' content changed or even if, god forbid, they became 404 Not Found or otherwise unavailable. (I note in passing that since the referenced page is part of a public domain website and available on github, anyone could easily mirror it and provide a replacement link to it here should that ever come to pass. But as I said, it's optional additional reference information anyway.)

Gamboge answered 4/9, 2014 at 3:45 Comment(3)
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.Travail
@JigarParekh In this case I think the link is very relevant as the specific problem the OP is trying to solve has been solved already and the answer besides the link has the relevant instructions to install the solution.Thruway
That answer contained everything I needed without following the link, because executing that Quicklisp command downloaded the tool and instructed me in how to use and customize it. Simple, beautiful, and effective.Inverson
I
5

Please replace

(setq common-lisp-hyperspec-root "/.emacs.d/HyperSpec/")

with

(setq common-lisp-hyperspec-root "~/.emacs.d/HyperSpec/")

or even

(setq common-lisp-hyperspec-root (expand-file-name "~/.emacs.d/HyperSpec/"))
Indifferent answered 15/5, 2014 at 16:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.