From: John Turner Date: Sat, 9 Mar 2024 20:15:21 +0000 (-0500) Subject: add ansi ctrl code filtering with ansi-color-filter-region X-Git-Url: https://jturnerusa.dev/gitweb/?a=commitdiff_plain;h=0d476575fbf70377b8f9f2efe6a7a4c912abd312;p=wgetpaste.el add ansi ctrl code filtering with ansi-color-filter-region --- diff --git a/wgetpaste.el b/wgetpaste.el index 3aafcb6..8136fcc 100644 --- a/wgetpaste.el +++ b/wgetpaste.el @@ -17,6 +17,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . +(require 'ansi-color) + (defgroup wgetpaste nil "Wgetpaste interface for emacs") @@ -82,6 +84,9 @@ ;; hooks +(defun wgetpaste-ansifilter () + (ansi-color-filter-region (point-min) (point-max))) + (defun wgetpaste-clear-stdout-buffer () (with-current-buffer (get-buffer-create wgetpaste-stdout-buffer) (erase-buffer))) @@ -97,6 +102,7 @@ (when wgetpaste-install-hooks (add-hook 'wgetpaste-before-upload-hook 'wgetpaste-clear-stdout-buffer) + (add-hook 'wgetpaste-before-upload-hook 'wgetpaste-ansifilter) (add-hook 'wgetpaste-after-upload-hook 'wgetpaste-save-url-to-clipboard) (add-hook 'wgetpaste-upload-failure-hook 'wgetpaste-failed))