最近几个月我一直在广泛使用Emacs作为我的主要开发环境,现在我已经到了一个点,我想学习它自己的Emacs Lisp为Emacs写我自己的小东西并将它扩展到我的个人需求.
话虽如此,我还想学习Common Lisp一段时间,一起玩,探索一种新语言.我的问题是,我应该从哪里开始?请问Emacs Lisp能否为我提供必要的知识,以便以后更轻松地获取Common Lisp,反之亦然?我基本上对每条路径的效率感兴趣,以便在我最终决定从一种方言转移到另一种方言时最小化学习曲线.
在Python中,你可能会做类似的事情
fout = open('out','w')
fin = open('in')
for line in fin:
fout.write(process(line)+"\n")
fin.close()
fout.close()
Run Code Online (Sandbox Code Playgroud)
(我认为它在许多其他语言中也会类似).在Emacs Lisp中,你会做类似的事吗?
(find-file 'out')
(setq fout (current-buffer)
(find-file 'in')
(setq fin (current-buffer)
(while moreLines
(setq begin (point))
(move-end-of-line 1)
(setq line (buffer-substring-no-properties begin (point))
;; maybe
(print (process line) fout)
;; or
(save-excursion
(set-buffer fout)
(insert (process line)))
(setq moreLines (= 0 (forward-line 1))))
(kill-buffer fin)
(kill-buffer fout)
Run Code Online (Sandbox Code Playgroud)
我从Emacs Lisp获得灵感(和代码):逐行处理文件.或者我应该尝试完全不同的东西?以及如何""从print语句中删除?