emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master bdbbc65 5/6: Remove ANSI schmutz from zshdb output


From: Rocky Bernstein
Subject: [elpa] master bdbbc65 5/6: Remove ANSI schmutz from zshdb output
Date: Tue, 2 Aug 2016 12:31:36 +0000 (UTC)

branch: master
commit bdbbc65028af8deb55a4e474be43b5b99e6cc539
Author: rocky <address@hidden>
Commit: rocky <address@hidden>

    Remove ANSI schmutz from zshdb output
---
 realgud/debugger/zshdb/core.el  |    9 +++++++++
 realgud/debugger/zshdb/zshdb.el |   20 ++++++++++++++------
 test/test-zshdb.el              |    4 +++-
 3 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/realgud/debugger/zshdb/core.el b/realgud/debugger/zshdb/core.el
index e8c5a6e..20a7cbe 100644
--- a/realgud/debugger/zshdb/core.el
+++ b/realgud/debugger/zshdb/core.el
@@ -157,6 +157,15 @@ Note that path elements have been expanded via 
`realgud:expand-file-name-if-exis
                              realgud:zshdb-minibuffer-history
                              "sh" "\\.\\(?:z\\)?sh$"))
 
+(defun realgud:zshdb-remove-ansi-schmutz()
+  "Remove ASCII escape sequences that node.js 'decorates' in
+prompts and interactive output with"
+  (add-to-list
+   'comint-preoutput-filter-functions
+   (lambda (output)
+     (replace-regexp-in-string "\033\\[\\?[0-9]+[GKJhl]" "" output)))
+  )
+
 (defun zshdb-reset ()
   "Zshdb cleanup - remove debugger's internal buffers (frame,
 breakpoints, etc.)."
diff --git a/realgud/debugger/zshdb/zshdb.el b/realgud/debugger/zshdb/zshdb.el
index 2b07cc1..0812997 100644
--- a/realgud/debugger/zshdb/zshdb.el
+++ b/realgud/debugger/zshdb/zshdb.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2011, 2014-2015 Free Software Foundation, Inc
+;; Copyright (C) 2011, 2014-2016 Free Software Foundation, Inc
 
 ;; Author: Rocky Bernstein <address@hidden>
 
@@ -14,6 +14,7 @@
 (require-relative-list '("../../common/run")    "realgud:")
 (require-relative-list '("core" "track-mode")   "realgud:zshdb-")
 
+(declare-function realgud:zshdb-remove-ansi-schmutz 'realgud:zshdb-core)
 (declare-function zshdb-track-mode (bool))
 (declare-function zshdb-query-cmdline  'realgud:zshdb-core)
 (declare-function zshdb-parse-cmd-args 'realgud:zshdb-core)
@@ -69,11 +70,18 @@ marginal icons is reset. See `loc-changes-clear-buffer' to 
clear
 fringe and marginal icons.
 "
   (interactive)
-  (realgud:run-debugger realgud:zshdb-command-name 'zshdb-query-cmdline
-                       'zshdb-parse-cmd-args
-                       'realgud:zshdb-minibuffer-history
-                       opt-cmd-line no-reset)
-  )
+  (let ((cmd-buf
+        (realgud:run-debugger realgud:zshdb-command-name 'zshdb-query-cmdline
+                              'zshdb-parse-cmd-args
+                              'realgud:zshdb-minibuffer-history
+                              opt-cmd-line no-reset)))
+    (if cmd-buf
+       (with-current-buffer cmd-buf
+         ;; FIXME should allow customization whether to do or not
+         ;; and also only do if hook is not already there.
+         (realgud:zshdb-remove-ansi-schmutz)
+         )
+      )))
 
 (defalias 'zshdb 'realgud:zshdb)
 
diff --git a/test/test-zshdb.el b/test/test-zshdb.el
index 86eb5e5..a908777 100644
--- a/test/test-zshdb.el
+++ b/test/test-zshdb.el
@@ -35,7 +35,9 @@
     (assert-equal  expanded-name script-filename "file name check")
     (assert-equal (list expanded-name "3" "5")
                  (cdr cmd-args) "command args listified")
-    ))
+    )
+  (current-buffer)
+  )
 
 (note "zshdb-parse-cmd-args")
 (assert-equal (list nil '("zshdb")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]