是否有可能为clisp解释器提供类似bash的命令历史记录?

时间:2014-05-27 08:33:50

标签: history clisp

我使用GNU CLISP 2.49解释器。当我开始评估表达式时,我可以使用向上和向下箭头键循环它们。但是,当我退出并重新启动时,它们都不可用。有没有办法在CLISP中跨会话获得命令历史记录?

3 个答案:

答案 0 :(得分:2)

请参阅Advanced Readline and History Functionalityexamples

(defparameter *history-file* "readline-history-file")
(readline:write-history *history-file*)            
(readline:append-history 1000 *history-file*)      
(readline:read-history *history-file*)            
(readline:read-history-range *history-file* 0 -1)  
(readline:history-truncate-file *history-file* 10) 

答案 1 :(得分:1)

在我的Mac上,我使用rlwrap选项使用--always-readline

rlwrap --always-readline clisp

答案 2 :(得分:1)

具有讽刺意味的是,rlwrap被推荐为clisp的解决方案,因为clisp famously正好采用了GPL,因为它与readline相关联,使其更好(上下文感知) )完成比rlwrap所能完成的。引用rlwrap手册页:

BUGS and LIMITATIONS
   Though it is flexible, delivers the goods (readline functionality), and adheres 
   to  the  Unix  "many  small  tools"  paradigm, rlwrap  is a kludge. It cannot 
   know anything about command's internal state, which makes context-sensitive 
   completion impossible. Using the readline library from within command is 
   still the best option.

显然,必须配置持久性历史记录(请参阅sds'的回答),这对于新用户来说可能会非常棘手,但在此之后,您将拥有比rlwrap更加聪明的命令行