Вопрос

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.

Это было полезно?

Решение 2

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/"))

Другие советы

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top