「..」を追加/削除するトグルが必要です (スペースがありますが、もっとはっきりさせることはできません) 文字列 (ポイント) の上のすべての行の前に。これが私の最善の策です:
(defun rst-comment-above (Point)
(interactive "d")
(save-excursion
(goto-char 1)
(cond
((numberp (get this-command 'state))
((replace-regexp "^\\.\\. " "" nil (point) (get this-command 'state)))
(put this-command 'state ""))
(t
(replace-regexp "^" ".. " nil (point) Point)
(put this-command 'state Point))
)))
初めて機能しますが、2回目は次のように述べています。
(invalid-function
(replace-regexp "^\\.\\. " "" nil (point) (get this-command (quote state))))
編集:
@ ユーザー 4815162342:
だから私は上記のことをコメントします:
次に、新しい行を挿入します。
次に、コメントを外したいのですが、次のようになります。
しかし、おそらくそれほど重要ではありません。私は通常、コメント欄には何も入力しません。私はただ問題に注意します。さらに重要なこと'state
は、指定されたファイルをセッション間で保存することです。実装するのは難しいですか?