如何在Common Lisp REPL中修复<tab> -triggered自动文档查找的URL?

时间:2016-10-04 02:53:10

标签: lisp common-lisp read-eval-print-loop clisp tab-completion

概要

我试图成为使用Lisp的能力。虽然我很舒服 命令行和其他口译员的各种REPL(即pythonirb / pry, perl -d),当它到来时,我一直觉得自己像个绝对的新手 Lisp,出于某种原因。

在Common Lisp REPL(clisp)中,当我在a的末尾使用密钥时 功能名称,似乎是试图为我提供参考信息 关于那个功能。这听起来很有用..如果真的有用的话。下面 是我这样做时实际发生的事情。据我所知,它似乎是 查找不存在(或不再存在)的URL上的函数。也许 HyperSpec移动了吗?解决这个问题的正确方法是什么?我该怎么办?

补遗

我如何运行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相关的软件包

$ 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

当我尝试查找函数时得到的结果:

$ 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]> 

1 个答案:

答案 0 :(得分:4)

我认为this article可以帮到你。

实质上,您必须设置CUSTOM:*BROWSERS*列表,因此clisp知道如何打开文档。

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

但是你必须在你的系统上安装chrome。但是你明白了。