我正在尝试设置一个速度模板,当使用 Cu 前缀调用该模板时,它将用标签 \begin{environment} 和 \end{environment} 包围该区域,并在每行的开头插入标签 \item地区。但是它给出了“保存游览:Args 超出范围:2247、2312”错误。
(require 'tempo)
(setq tempo-interactive t)
(tempo-define-template "env"
'("\\begin{" (p "Environment: " environment) "}" > n>
r> n>
"\\end{" (s environment) "}" > n
(save-excursion
(narrow-to-region start end)
(goto-char (point-min))
(while (re-search-forward "^" nil t) (replace-match "\\item " nil t))
(widen)
))
"env"
"Insert a LaTeX environment.")
(defun item (start end)
(interactive "r")
(save-excursion
(narrow-to-region start end)
(goto-char (point-min))
(while (re-search-forward "^" nil t) (replace-match "\\item " nil t))
(widen)
))
item 函数本身在区域上运行良好。我尝试在 tempo-template 中调用 elisp 函数项:
(tempo-define-template "env"
'("\\begin{" (p "Environment: " environment) "}" > n>
r> n>
"\\end{" (s environment) "}" > n
(item point-min point-max)
)
"env"
"Insert a LaTeX environment.")
但是,这会给出“eval:符号的值作为变量是 void:point-min”错误。任何解决问题的指针表示赞赏。