Emacs Lisp 宏步进器
SLIME 宏步进器有 Elisp 类似物吗?具体来说,我正在寻找将代码扩展到新缓冲区中的下一个扩展步骤(或只是最终扩展)的东西。
天真的
(defun macroexpand-point ()
(interactive)
(let ((b (get-buffer-create "*el-macroexpansion*"))
(expansion (format "%s" (macroexpand (thing-at-point 'sexp)))))
(with-current-buffer b
(insert expansion)
(display-buffer b))))
不会做我在这里期待的事情。
Is there an Elisp analogue for the SLIME macrostepper? Specifically, I'm looking for something that expands code at point into the next expansion step (or just the final expansion) in a new buffer.
The naive
(defun macroexpand-point ()
(interactive)
(let ((b (get-buffer-create "*el-macroexpansion*"))
(expansion (format "%s" (macroexpand (thing-at-point 'sexp)))))
(with-current-buffer b
(insert expansion)
(display-buffer b))))
doesn't do what I'm expecting here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也许你需要这个:
整个函数可以更简洁地表达
Perhaps you need this:
The whole function can be expressed more succintly thus
您可能会发现 imacroexpand.el做你想做的事。
You may find that imacroexpand.el does what you want.
人们可能会发现 macrostep 包很有用。
关于 Macrostep 的快速指南:
安装软件包后,无需进一步自定义,您可以执行以下操作:
将光标移至要扩展的表达式之前,然后执行
Mx Macrostep-expand eeee e
来扩展它的步骤一步一步。简短的帮助消息显示在回显区域中,说明如何退出和如何取消展开。可以在 dash.el 中的
->>
宏示例上对此进行测试页面,不太简单也不太复杂。One might find the macrostep package useful.
Quick howto on macrostep:
After you install the package, and without further customization, you can do this:
Move cursor before the expression you want to expand, then do
M-x macrostep-expand e e e e e
to expand it step by step. Short help message gets displayed in the echo area on how to quit and how to unexpand.One can test this out on the
->>
macro examples from dash.el page, which are not too simple and not too complicated.