@@ -946,7 +946,33 @@ prefix argument PROMPT-FOR-SYMBOL, it prompts for a symbol name."
946
946
; ;;; Response parsing
947
947
; ;;; ================
948
948
949
- (defvar inf-clojure--redirect-buffer-name " *Inf-Clojure Redirect Buffer*" )
949
+ (defvar inf-clojure--redirect-buffer-name " *Inf-Clojure Redirect Buffer*"
950
+ " The name of the buffer used for process output redirection." )
951
+
952
+ (defvar inf-clojure--log-file-name " .inf-clojure.log"
953
+ " The name of the file used to log process activity." )
954
+
955
+ (defvar inf-clojure-log-activity nil
956
+ " Log process activity?.
957
+ Inf-Clojure will create a log file in the project folder named
958
+ `inf-clojure--log-file-name' and dump the process activity in it
959
+ in case this is not nil." )
960
+
961
+ (defun inf-clojure--log-string (string &optional type )
962
+ " Log STRING to file, according to `inf-clojure-log-response' .
963
+ The optional TYPE will be converted to string and printed before
964
+ STRING if present."
965
+ (when inf-clojure-log-activity
966
+ (write-region (concat " \n "
967
+ (when type
968
+ (concat (prin1-to-string type) " | " ))
969
+ (let ((print-escape-newlines t ))
970
+ (prin1-to-string string)))
971
+ nil
972
+ (expand-file-name inf-clojure--log-file-name
973
+ (inf-clojure-project-root))
974
+ 'append
975
+ 'no-annoying-write-file-in-minibuffer )))
950
976
951
977
; ; Originally from:
952
978
; ; https://github.com/glycerine/lush2/blob/master/lush2/etc/lush.el#L287
@@ -958,6 +984,7 @@ string will start from (point) in the results buffer. If
958
984
END-STRING is nil, the result string will end at (point-max) in
959
985
the results buffer. It cuts out the output from and including
960
986
the `inf-clojure-prompt`."
987
+ (inf-clojure--log-string command :cmd )
961
988
(let ((work-buffer inf-clojure--redirect-buffer-name))
962
989
(save-excursion
963
990
(set-buffer (get-buffer-create work-buffer))
@@ -978,8 +1005,10 @@ the `inf-clojure-prompt`."
978
1005
(search-forward end-string nil t ))
979
1006
(point-max )))
980
1007
(prompt (when (search-forward inf-clojure-prompt nil t )
981
- (match-beginning 0 ))))
982
- (buffer-substring-no-properties beg (or prompt end))))))
1008
+ (match-beginning 0 )))
1009
+ (buffer-string (buffer-substring-no-properties beg (or prompt end))))
1010
+ (inf-clojure--log-string buffer-string :res )
1011
+ buffer-string))))
983
1012
984
1013
(defun inf-clojure--nil-string-match-p (string )
985
1014
" Return true iff STRING is not nil.
0 commit comments