我正在尝试编写一个 elisp 函数来获取一个文本区域,引用每一行,并将逗号放在每一行的末尾,除了最后一行。
这将是一个示例转换:
从
Aaaa Bbbb CCcc
DDddd eeeee ffffffff
ggggg hhh iiii
至:
"Aaaa Bbbb CCcc",
"DDddd eeeee ffffffff",
"ggggg hhh iiii"
这是我到目前为止所拥有的:
(defun quote-lines (p1 p2)
(interactive "r")
(save-excursion
(while (<= (point) p2) ; Would like to check if we are on
; the line after p2
(move-beginning-of-line nil)
(insert "\"")
(move-end-of-line nil)
(insert "\",")
(forward-line))
(move-end-of-line nil)
(delete-char 1)))
任何使我的 elisp 函数更惯用的帮助也将不胜感激。