;; バッファ内で正規表現にマッチする行を抜き出す (defun petit-grep (pattern) (interactive "sPetit grep: ") (save-excursion (goto-char (point-min)) (with-output-to-temp-buffer "*petit-grep*" (while (re-search-forward pattern nil t) (princ (thing-at-point 'line)))))) ;; ナローイング対応 (defun petit-grep2 (pattern) (interactive "sPetit grep: ") (save-excursion (save-restriction (widen) (goto-char (point-min)) (with-output-to-temp-buffer "*petit-grep*" (while (re-search-forward pattern nil t) (princ (thing-at-point 'line)))))) )
P112
- 作者: るびきち
- 出版社/メーカー: 技術評論社
- 発売日: 2011/11/26
- メディア: 単行本(ソフトカバー)
- 購入: 5人 クリック: 220回
- この商品を含むブログを見る