diff --git a/modules/home/users/msyds/emacs/lisp/syd/clojure.el b/modules/home/users/msyds/emacs/lisp/syd/clojure.el index 9d46de1..44ec91a 100755 --- a/modules/home/users/msyds/emacs/lisp/syd/clojure.el +++ b/modules/home/users/msyds/emacs/lisp/syd/clojure.el @@ -35,49 +35,69 @@ :straight nil ; Part of `cider'. :hook (clojure-mode-local-vars . cider-mode) :custom ((cider-show-error-buffer nil) - ;; Download Java source archives for local Javadoc and jump-to-def - ;; functionality. - (cider-download-java-sources t)) + ;; Download Java source archives for local Javadoc and jump-to-def + ;; functionality. + (cider-download-java-sources t)) :general ;; DEPRECATED: Remove once a `map!' equivalent is implemented. (:keymaps 'cider-repl-mode-map - :states '(normal insert) - "C-k" #'cider-repl-backward-input - "C-j" #'cider-repl-forward-input - "C-s" #'consult-history) + :states '(normal insert) + "C-k" #'cider-repl-backward-input + "C-j" #'cider-repl-forward-input + "C-s" #'consult-history) ;; DEPRECATED: Remove once a `map!' equivalent is implemented. (:keymaps '(cider-repl-mode-map clojure-mode-map) - :states '(normal visual motion emacs insert) - :major-modes t - :prefix syd-localleader-key - :non-normal-prefix syd-alt-localleader-key - "\"" #'cider-jack-in-cljs - "'" #'cider-jack-in-clj - "c" #'cider-connect-clj - "C" #'cider-connect-cljs - "r l" #'cider-load-buffer - "r n" #'cider-repl-set-ns - "r r" #'cider-ns-refresh - "r R" #'cider-restart - "r q" #'cider-quit - "d d" #'cider-debug-defun-at-point - "M-:" #'cider-read-and-eval - "h d" #'cider-doc - "h c" #'cider-cheatsheet - "h j" #'cider-javadoc - "h n" #'cider-browse-ns - "T n" #'cider-test-run-ns-tests - "T r" #'cider-test-rerun-failed-tests - "T R" #'cider-test-rerun-test - "x" #'cider-scratch) + :states '(normal visual motion emacs insert) + :major-modes t + :prefix syd-localleader-key + :non-normal-prefix syd-alt-localleader-key + "\"" #'cider-jack-in-cljs + "'" #'cider-jack-in-clj + "c" #'cider-connect-clj + "C" #'cider-connect-cljs + "r l" #'cider-load-buffer + "r n" #'cider-repl-set-ns + "r r" #'cider-ns-refresh + "r R" #'cider-restart + "r q" #'cider-quit + "d d" #'cider-debug-defun-at-point + "M-:" #'cider-read-and-eval + "h d" #'cider-doc + "h c" #'cider-cheatsheet + "h j" #'cider-javadoc + "h n" #'cider-browse-ns + "T n" #'cider-test-run-ns-tests + "T r" #'cider-test-rerun-failed-tests + "T R" #'cider-test-rerun-test + "x" #'cider-scratch) (:keymaps 'cider-repl-mode-map - :states 'insert - "S-" #'cider-repl-newline-and-indent) + :states 'insert + "S-" #'cider-repl-newline-and-indent) :config (add-hook 'cider-mode-hook #'eldoc-mode) (with-eval-after-load 'consult (add-to-list 'consult-mode-histories - '(cider-repl-mode cider-repl-input-history nil cider-repl-bol-mark)))) + '(cider-repl-mode cider-repl-input-history nil cider-repl-bol-mark))) + + ;; Lines of the form "!!!graph:/path/to/file.svg" are be displayed + ;; in-buffer by this hook. + (syd-add-hook 'cider-repl-preoutput-hook + (defun syd-clojure--render-graphviz-h (s) + (if (string-match (rx bol "!!!graph:" + (group (* anychar) ".svg")) + s) + (let ((beg (match-beginning 0)) + (end (match-end 0)) + (file (match-string 1 s))) + (message "%d %d %s" beg end file) + (add-display-text-property + beg end + 'display + `(image :type svg + :file ,file) + s) + s) + s)))) (provide 'syd/clojure)