Created
January 12, 2023 15:44
-
-
Save dotemacs/c194d071b33320100abbf57b439ae34e to your computer and use it in GitHub Desktop.
Rough first draft of antifennel.el, a way to call `antifennel` CLI from within Emacs buffers
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
;; antifennel.el --- Turn Lua code into Fennel code | |
(defgroup antifennel nil | |
"Tool to convert Lua code into Fennel code." | |
:group 'tools) | |
(defcustom antifennel-cli "antifennel" | |
"Path to the antifennel executable" | |
:type 'string | |
:group 'antifennel) | |
;;;###autoload | |
(defun antifennel (beginning end) | |
(interactive "r") | |
(save-excursion | |
(kill-ring-save beginning end) | |
(let ((temp-file (make-temp-file "antifennel"))) | |
(write-region (substring-no-properties (car kill-ring)) nil temp-file 'append) | |
(thread-first (list antifennel-cli temp-file) | |
(string-join " ") | |
shell-command-to-string | |
kill-new) | |
(switch-to-buffer | |
(get-buffer-create "*antifennel*")) | |
(insert (car kill-ring-yank-pointer))))) | |
(provide 'antifennel) | |
;;; antifennel.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment