【发布时间】:2018-06-04 12:37:36
【问题描述】:
我正在运行这个函数(交互式和挂钩)来重新格式化源代码
(defun a-style ()
(interactive)
(save-excursion
(shell-command-on-region (point-min) (point-max) "/usr/local/bin/astyle -A10 -s4 -m0 -M40 -k1 -W0 -z2 -xd -CSKNLwYfpHjJcn" t t)))
但保存行程似乎不起作用,该点总是跳转到 1(尽管 shell 命令有效!)。我在这里遗漏了什么明显的东西吗?
谢谢, 马里奥
编辑:
所以我最终还是以天真的方式做到了:
(defun a-style ()
(interactive)
(setq temp-point (point))
(shell-command-on-region (point-min) (point-max) "/usr/local/bin/astyle -A10 -s4 -m0 -M40 -k1 -W0 -z2 -xd -CSKNLwYfpHjJcn" t t)
(goto-char temp-point))
有点愚蠢,但我想做的事。如果有人知道更好的解决方案,我将不胜感激。
【问题讨论】:
-
用
let代替setq怎么样?