【GNU】Emacs Lisp 【Elisp】 (295レス)
前次1-
抽出解除 必死チェッカー(本家) (べ) 自ID レス栞 あぼーん

リロード規制です。10分ほどで解除するので、他のブラウザへ避難してください。
273: 2023/10/13(金)14:18 ID:oUGpYLYU(1/4) AAS
(defun comment-traversal (beg end func)
(save-excursion
(let (spt ept)
(goto-char beg)
(while (and (< (point) end)
(setq spt (comment-search-forward end t)))
(setq ept (progn
(goto-char spt)
(unless (or (comment-forward)
(eobp))
省3
274: 2023/10/13(金)14:19 ID:oUGpYLYU(2/4) AAS
(defun not-comment-traversal (beg end func)
(save-excursion
(let (spt
(ept (1- (goto-char beg))))
(while (and (< (point) end)
(setq spt (comment-search-forward end t)))
(funcall func (1+ ept) spt)
(setq ept (progn
(goto-char spt)
(unless (or (comment-forward)
省4
275: 2023/10/13(金)14:20 ID:oUGpYLYU(3/4) AAS
最初のはコメントを抜き出すコード
次のはコメント以外を抜き出すコード
バッファー内のコメントを消していくのは難易度が高い
コメント以外を出力してリダイレクトするのが簡単だろう
↓こんな感じ
(not-comment-traversal (point-min) (point-max)
(lambda (beg end)
(print (buffer-substring beg end))))
ちなみにコメントはEmacsが把握してるので、このコードは言語非依存だ
277: 2023/10/13(金)16:01 ID:oUGpYLYU(4/4) AAS
Emacs Lispのコードなんてまともに学習できないよw
前次1-
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.015s