我有这段代码:
(define-key lisp-interaction-mode-map (kbd "C-c C-e")
(lambda ()
(let ((result (eval (read (buffer-substring
(point-at-bol) (point-at-eol)))))
(goto-char (point-at-eol))))
(insert (format " ; => %s" result))))
但它不起作用,如
Wrong type argument: commandp, (lambda nil (let ((result (eval (read (buffer-substring (point-at-bol) (point-at-eol))))) (goto-char (point-at-eol)))) (insert (format " ; => %s" result)))
答案 0 :(得分:4)
此命令不应基于每行运行。改为通过sexp移动点。
Here是我创建的基本上可以做到的库,但可以使用多行 结果,并且是可重入的。所以你可以改变一些东西,并重新运行 命令更新结果。
编辑:正确链接到提到的包。
答案 1 :(得分:1)
解决。
(define-key lisp-interaction-mode-map (kbd "C-c C-e")
(lambda ()
(interactive)
(let ((result (eval (read (buffer-substring
(point-at-bol) (point-at-eol))))))
(goto-char (point-at-eol))
(insert (format " ; ⇒ %s" result)))))