【GNU】Emacs Lisp 【Elisp】 (295レス)
【GNU】Emacs Lisp 【Elisp】 http://mevius.5ch.net/test/read.cgi/tech/1382223056/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
必死チェッカー(本家)
(べ)
自ID
レス栞
あぼーん
リロード規制
です。10分ほどで解除するので、
他のブラウザ
へ避難してください。
273: デフォルトの名無しさん [sage] 2023/10/13(金) 14:18:48.79 ID:oUGpYLYU (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)) (error "Can't find the comment end")) (point))) (funcall func spt ept))))) http://mevius.5ch.net/test/read.cgi/tech/1382223056/273
274: デフォルトの名無しさん [sage] 2023/10/13(金) 14:19:30.72 ID:oUGpYLYU (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) (eobp)) (error "Can't find the comment end")) (point)))) (funcall func ept (min end (1- (point-max))))))) http://mevius.5ch.net/test/read.cgi/tech/1382223056/274
275: デフォルトの名無しさん [sage] 2023/10/13(金) 14:20:49.82 ID:oUGpYLYU 最初のはコメントを抜き出すコード 次のはコメント以外を抜き出すコード バッファー内のコメントを消していくのは難易度が高い コメント以外を出力してリダイレクトするのが簡単だろう ↓こんな感じ (not-comment-traversal (point-min) (point-max) (lambda (beg end) (print (buffer-substring beg end)))) ちなみにコメントはEmacsが把握してるので、このコードは言語非依存だ http://mevius.5ch.net/test/read.cgi/tech/1382223056/275
277: デフォルトの名無しさん [sage] 2023/10/13(金) 16:01:32.18 ID:oUGpYLYU Emacs Lispのコードなんてまともに学習できないよw http://mevius.5ch.net/test/read.cgi/tech/1382223056/277
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.022s