【发布时间】:2012-11-06 13:27:39
【问题描述】:
如何编写一个函数,只要找到一个变量,它就会返回 t(为了允许循环):
(setq x 1)
(while ("backward search for regexp "%x" equals true") ;where x is variable
(setq x (+ x 1))
(insert (concat "%" (int-to-string x)))
)
示例:如果找到 %1 (x=1),它会将 x 加 1。如果找到 %2 (x=2),它会将 x 加 1。 假设在向后搜索中找不到 %3,while 循环停止并插入 "%" + "3" (%3)。
我只是不明白如何在向后搜索中返回 true。
【问题讨论】:
标签: function loops emacs while-loop