[英]Emacs proper cl-flet indentation?
cl-flet
目前的縮進對我來說真的很難看。 例如,見:
(defun foo (lst)
(cl-flet ((unusually-long-bar (x)
(1+ x)
(1+ x)
(1+ x)))
(mapcar #'unusually-long-bar lst)))
我想將它設置為更合理的東西,例如:
(defun foo (lst)
(cl-flet ((unusually-long-bar (x)
(1+ x)
(1+ x)
(1+ x)))
(mapcar #'unusually-long-bar lst)))
我怎樣才能做到這一點?
以下應該有效:
(setq lisp-indent-function 'common-lisp-indent-function)
(eval-after-load "cl-indent"
'(progn
(put 'cl-flet 'common-lisp-indent-function
(get 'flet 'common-lisp-indent-function))
))
通過除了Sabof的回答方式,這里是從所有Common Lisp的符號,其副本縮進規則片段cl-
前綴Emacs的等價物,當后者存在:
(load-library "cl-indent") ; defines the common-lisp-indent-function properties
(cl-loop for symbol being the symbols
for cl-indent-rule = (get symbol 'common-lisp-indent-function)
for elisp-equivalent = (intern-soft (concat "cl-" (symbol-name symbol)))
when (and cl-indent-rule elisp-equivalent (fboundp elisp-equivalent))
do (put elisp-equivalent 'common-lisp-indent-function cl-indent-rule))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.