From: plugd Date: Wed, 14 Jul 2021 16:22:37 +0000 (+0200) Subject: Strip out colour formatting codes. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=lurk.git;a=commitdiff_plain;h=26875ae30c72b8471716530e9c5bfcf5da02e71a Strip out colour formatting codes. --- diff --git a/lurk.el b/lurk.el index 45d9424..68fff0d 100644 --- a/lurk.el +++ b/lurk.el @@ -580,7 +580,8 @@ portion of the source component of the message, as LURK doesn't use this.") (underline nil) (strikethrough nil) (prev-point (point))) - (while (re-search-forward (rx (any "\x02\x1D\x1F\x1E")) nil t) + (while (re-search-forward (rx (or (any "\x02\x1D\x1F\x1E\x0F") + (: "\x03" (+ digit) (opt "," (* digit))))) nil t) (let ((beg (+ (match-beginning 0) 1))) (if bold (add-face-text-property prev-point beg '(:weight bold))) @@ -594,7 +595,13 @@ portion of the source component of the message, as LURK doesn't use this.") ("\x02" (setq bold (not bold))) ("\x1D" (setq italics (not italics))) ("\x1F" (setq underline (not underline))) - ("\x1E" (setq strikethrough (not strikethrough)))) + ("\x1E" (setq strikethrough (not strikethrough))) + ("\x0F" ; Reset + (setq bold nil) + (setq italics nil) + (setq underline nil) + (setq strikethrough nil)) + (_)) (delete-region (match-beginning 0) (match-end 0)) (setq prev-point (point))))) (buffer-string)))