手元のファイルのansi color codeを取り除きたい場合の関数
手元でテキトウに正規表現作っただけなのでミスっているかも。
(defun my:strip-ansi-color-region (beg end) (interactive "r") (unless (region-active-p) (setq beg (point-min)) (setq end (point-max))) (save-excursion (save-restriction (narrow-to-region beg end) (goto-char (point-min)) (while (re-search-forward "\\[[0-9]+;?[0-9]*m" nil t 1) (replace-match "") ))))
こういうreplace-regexpを模したような関数をけっこう定義している気がする。
(replace-regexp "\\[[0-9]+;?[0-9]*m" "")