我有下面的文本(用实际的制表符代替 \t),我需要在“描述”之后的制表符后面获取所有文本,直到缓冲区结束。
key1\tval1
key2\tval2
key3\tval3
Description\tlots and lots and lots and lots and lots lots
and lots and lots and lots and lots lots and lots and lots and
lots and lots lots and lots and lots and lots and lots lots and
lots lots and lots and lots and lots and lots lots and lots lots
and lots and lots and lots and lots lots and lots lots and lots
and lots and lots and lots lots and lots lots and lots and lots
and lots and lots lots and lots lots and lots and lots and lots
and lots lots and lots lots and lots and lots and lots and lots
这是lisp函数:
(defun find-description()
(interactive)
(goto-char (point-min))
(when (re-search-forward "Description\t")
(setq myStr (buffer-substring (point) (end-of-line)))
(goto-char (point-max))
(insert "\n\n\ndescription=")
(insert myStr)
)
)
这在 (setq 行出现错误:
Wrong type argument: integer-or-marker-p, nil
我假设在正则表达式搜索之后,该点将在 Description\t 之后。那么为什么设置变量不起作用呢?