【发布时间】:2013-08-14 17:21:17
【问题描述】:
为我定义的 Emacs Lisp 宏指定缩进样式的两种流行方式之间有什么区别或优缺点?
声明方式:
(defmacro my-dotimes-1 (num &rest body)
(declare (indent 1)) ; <---
`(let ((it 0))
(while (< it ,num)
,@body
(setq it (1+ it)))))
放置方式:
(defmacro my-dotimes-2 (num &rest body)
`(let ((it 0))
(while (< it ,num)
,@body
(setq it (1+ it)))))
(put 'my-dotimes-2 'lisp-indent-function 1) ; <---
(名称 it 不是 gensym,因为该示例是从 dash.el 的 --dotimes 宏复制而来的,该宏旨在用作照应宏。)
【问题讨论】:
标签: emacs macros elisp auto-indent