Search code examples
lispcommon-lispread-eval-print-loopclisptab-completion

How do I fix the URL for the <TAB>-triggered automatic documentation lookup in the Common Lisp REPL?


SYNOPSIS

I'm trying to become competent at using Lisp. Though I'm very comfortable with the command line and various REPLs for other interpreters (i.e. python, irb/pry, perl -d), I keep feeling like an absolute newbie when it comes to Lisp, for some reason.

In the Common Lisp REPL (clisp), when I use the key at the end of a function name, it seems to be trying to provide me with reference information about that function. This sounds damn useful.. if it actually worked. Below is what actually happens when I do this. As far as I can tell, it seems to be looking up the functions on a URL that doesn't (or no longer) exist/s. Perhaps the HyperSpec has moved? What's the right way to fix this? What should I do?

ADDENDA

How I'm running Lisp

$ uname -a
Linux bob 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ clisp --version
GNU CLISP 2.49 (2010-07-07) (built on toyol.buildd [127.0.1.1])
Software: GNU C 4.8.2 
gcc -falign-functions=4 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare -Wno-format-nonliteral -O -falign-functions=4 -DENABLE_UNICODE -DDYNAMIC_FFI -DDYNAMIC_MODULES -I.  -lreadline -lncurses -ldl /usr/lib/libavcall.so /usr/lib/libcallback.so  -lsigsegv libgnu_cl.a 
SAFETY=0 TYPECODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
libsigsegv 2.10
libreadline 5.2
libffcall 1.11
Features: 
(READLINE REGEXP SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN
 FFI GETTEXT UNICODE BASE-CHAR=CHARACTER WORD-SIZE=64 PC386 UNIX)
C Modules: (clisp i18n syscalls regexp readline)
Installation directory: /usr/lib/clisp-2.49/
User language: ENGLISH
Machine: X86_64 (X86_64) bob [127.0.1.1]

Lisp-related packages currently installed on the system

$ aptitude search lisp | grep '^i'
i   clisp                           - GNU CLISP, a Common Lisp implementation   
i   clisp-doc                       - GNU CLISP, a Common Lisp implementation (d
i A common-lisp-controller          - Common Lisp source and compiler manager   
i   dh-lisp                         - Debhelper to support Common Lisp related p

What I get when I try to look up a function:

$ clisp -q
[1]> (write-line <TAB><TAB>

WRITE-LINE is the symbol WRITE-LINE, lies in #<PACKAGE COMMON-LISP>, is accessible in 11 packages CLOS, COMMON-LISP, COMMON-LISP-USER, EXPORTING,
EXT, FFI, POSIX, READLINE, REGEXP, SCREEN, SYSTEM, names a
;; connecting to "http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Data/Map_Sym.txt"...connected...HTTP/1.1 404 Not Found
;; "Date: Tue, 04 Oct 2016 02:34:52 GMT"
;; "Server: Apache/2.2.16 (Debian)"
;; "Content-Length: 333"
;; "Connection: close"
;; "Content-Type: text/html; charset=iso-8859-1"
;; ""
;; "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">"
;; "<html><head>"
;; "<title>404 Not Found</title>"
;; "</head><body>"
;; "<h1>Not Found</h1>"
;; "<p>The requested URL /projects/iiip/doc/CommonLISP/HyperSpec/Data/Map_Sym.txt was not found on this server.</p>"
;; "<hr>"
;; "<address>Apache/2.2.16 (Debian) Server at www.ai.mit.edu Port 80</address>"
;; "</body></html>"
;; connecting to "http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Data/Symbol-Table.text"...connected...HTTP/1.1 200 OK...45,322 bytes
;; SYSTEM::GET-CLHS-MAP(#<IO INPUT-BUFFERED SOCKET-STREAM CHARACTER www.ai.mit.edu:80>)...978/978 symbols
 function.
ANSI-CL Documentation is at
"http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-str_m_write-line.html"
;; connecting to "http://clisp.cons.org/impnotes/id-href.map"...connected...HTTP/1.1 302 Found --> "https://clisp.cons.org:80/impnotes/id-href.map"
;; connecting to "http://clisp.cons.orghttps://clisp.cons.org:80/impnotes/id-href.map"...
*** - PARSE-INTEGER: substring "" does not have integer syntax at position 0
The following restarts are available:
ABORT          :R1      Abort main loop
Break 1 [2]> 

Solution

  • I think this article should help you.

    In essence you have to set up your CUSTOM:*BROWSERS* list, so clisp knows how to open the documentation.

    In your .clisprc.lisp

    (setf CUSTOM:*BROWSERS* '(
       (:CHROMIUM "/usr/bin/chromium" "~a")))
    (setf CUSTOM:*BROWSER* :CHROMIUM)
    (setf CUSTOM:CLHS-ROOT "http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/FrontMatter/")
    

    But you have to have chromium installed on your system. But you get the idea.