-1

以下にテキストがあり (\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 の直後になると想定しました。では、なぜ変数の設定がうまくいかないのでしょうか?

4

1 に答える 1