[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-clojure a36d2a0 111/313: Remove unwanted ansi chars fr
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-clojure a36d2a0 111/313: Remove unwanted ansi chars from the REPL output |
Date: |
Wed, 11 Aug 2021 09:59:57 -0400 (EDT) |
branch: elpa/inf-clojure
commit a36d2a0473a211078af995ef9ea28f00fe1e6b32
Author: Andrea Richiardi <a.richiardi.work@gmail.com>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>
Remove unwanted ansi chars from the REPL output
The change deletes some arbitrary characters that the Lumo REPL
emits.
---
inf-clojure.el | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/inf-clojure.el b/inf-clojure.el
index 7415765..51a4f0b 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -332,6 +332,7 @@ to continue it."
(setq comint-input-filter #'inf-clojure-input-filter)
(setq-local comint-prompt-read-only inf-clojure-prompt-read-only)
(add-hook 'comint-preoutput-filter-functions #'inf-clojure-preoutput-filter
nil t)
+ (add-hook 'comint-output-filter-functions 'inf-clojure--ansi-filter)
(add-hook 'completion-at-point-functions #'inf-clojure-completion-at-point
nil t)
(ansi-color-for-comint-mode-on))
@@ -356,6 +357,19 @@ to continue it."
"Remove subprompts from STRING."
(replace-regexp-in-string inf-clojure-subprompt "" string))
+(defconst inf-clojure--ansi-clear-line "\\[1G\\|\\[0J\\|\\[13G"
+ "Ansi codes sent by the lumo repl that we need to clear." )
+
+(defun inf-clojure--ansi-filter (string)
+ "Filter unwanted ansi character from STRING."
+ (save-excursion
+ ;; go to start of first line just inserted
+ (comint-goto-process-mark)
+ (goto-char (max (point-min) (- (point) (string-width string))))
+ (forward-line 0)
+ (while (re-search-forward inf-clojure--ansi-clear-line nil t)
+ (replace-match ""))))
+
(defun inf-clojure-preoutput-filter (str)
"Preprocess the output STR from interactive commands."
(cond
- [nongnu] elpa/inf-clojure 63c2f9e 082/313: Add possibility to customize more vars, (continued)
- [nongnu] elpa/inf-clojure 63c2f9e 082/313: Add possibility to customize more vars, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure d9e4400 087/313: Tweak the README a bit, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 117d8cb 090/313: Bump the clojure-mode and Emacs deps, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure e12db12 091/313: Fix prompt being included in input history, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure e6a4ef3 093/313: Add some handy GitHub templates to improve the contribution process, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 6a354dc 097/313: Add defcustom `inf-clojure-prompt-on-set-ns` (#46), ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 6e55048 099/313: [Fix #42] Add a defcustom controlling the window in which the REPL buffer is displayed, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 872c143 101/313: Handle properly ANSI color escape sequences in the REPL, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 2e1dd6c 108/313: Update the "Usage" section of the README, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 916ec97 106/313: Infer the customization group from defcustom names, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure a36d2a0 111/313: Remove unwanted ansi chars from the REPL output,
ELPA Syncer <=
- [nongnu] elpa/inf-clojure 3929054 113/313: Modify CHANGELOG and README for REPL types, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure d265232 115/313: Fix a problem with pcase on inf-clojure-repl-type, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure ac74e20 117/313: Kill inf-clojure-var-at-point, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure cfad839 122/313: Officially support lumo -d (dumb terminal) only, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure dda0a43 125/313: Fix newline append on eval functions, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 896edd1 131/313: Handle inf-clojure-arglists corner cases, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure ebd1494 135/313: Support lumo's apropos, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 2341aa2 136/313: Support lumo's source, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 1014e24 141/313: Extend the README a bit, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 4a87862 161/313: Calculate response boundaries explicitly, ELPA Syncer, 2021/08/11