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

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

[nongnu] elpa/inf-clojure 85d3d41 014/313: Extract a chomp helper


From: ELPA Syncer
Subject: [nongnu] elpa/inf-clojure 85d3d41 014/313: Extract a chomp helper
Date: Wed, 11 Aug 2021 09:59:37 -0400 (EDT)

branch: elpa/inf-clojure
commit 85d3d41fecb9c288f72e88674dae573bc4fd9a66
Author: Bozhidar Batsov <bozhidar@tradeo.com>
Commit: Bozhidar Batsov <bozhidar@tradeo.com>

    Extract a chomp helper
---
 inf-clojure.el | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/inf-clojure.el b/inf-clojure.el
index 3a0f3c1..a6e5841 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -233,16 +233,18 @@ to continue it."
   "t if STR does not match `inf-clojure-filter-regexp'."
   (not (string-match inf-clojure-filter-regexp str)))
 
+(defun inf-clojure-chomp (string)
+  (if (string-match "[\n]\\'" string)
+      (replace-match "" t t string)
+    string))
+
 (defun clojure-preoutput-filter (str)
   "Preprocess the output STR from interactive commands."
-  (if (string-prefix-p "clojure-" (symbol-name (or this-command last-command)))
-      ;; prepend a newline to the output string
-      (let ((string (concat "\n" str)))
-        ;; strip the extra trailing newline
-        (if (string-match "[\n]+\\'" string)
-            (replace-match "" t t string)
-          string))
-    str))
+  (cond
+   ((string-prefix-p "clojure-" (symbol-name (or this-command last-command)))
+    ;; prepend a newline to the output string
+    (inf-clojure-chomp (concat "\n" str)))
+   (t str)))
 
 ;;;###autoload
 (defun inf-clojure (cmd)



reply via email to

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