Last active
August 29, 2015 13:56
-
-
Save mkhattab/8970287 to your computer and use it in GitHub Desktop.
Evaluate last sexp as inline comment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; my-scheme configuration | |
(defun my-scm-preoutput-filter (string) | |
(with-current-buffer (window-buffer (frame-selected-window)) | |
(save-restriction | |
(save-excursion | |
(backward-sexp) | |
(forward-sexp) | |
(paredit-comment-dwim) | |
(save-excursion | |
(unless (looking-at "=> ") | |
(insert "=> "))) | |
(let ((beg (+ (point) 3))) | |
(move-end-of-line 1) | |
(delete-region beg (point)) | |
(string-match "^;Value: \\(.*\\)$" string) | |
(insert (substring string (match-beginning 1) (match-end 1))))))) | |
(with-current-buffer (process-buffer (scheme-proc)) | |
(set (make-local-variable 'comint-preoutput-filter-functions) nil)) | |
string) | |
(defun my-scm-eval-last-sexp-inline-comment () | |
(interactive) | |
(let ((proc (scheme-proc))) | |
(with-current-buffer (process-buffer proc) | |
(set (make-local-variable 'comint-preoutput-filter-functions) '(my-scm-preoutput-filter))) | |
(scheme-send-last-sexp))) | |
(provide 'my-scheme) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment