-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add watch support #9
Comments
Realized that while watch mode would be cool, it's not required for alpha. more important is just fixing the svg issue. |
do you mean real time recompile and refeshing if the content of the source file chagnes by this watch mode? |
yea....that was the idea. d2 already supports some server implementation, but I would need to write a bit to manage those processes. it's definitely a cool idea, but could easily get messy if handled incorrectly. |
I was able to get watch functionality working by adding a function to
And then turning on
|
I did a similar approach with (defun compile-on-save-start ()
(let ((compile-buffer (compilation-find-buffer)))
(unless (get-buffer-process compile-buffer)
(let ((display-buffer-alist '(("^*compilation*" . (display-buffer-no-window)))))
(recompile)))))
(define-minor-mode compile-on-save-mode
"Minor mode to automatically call `recompile' whenever the
current buffer is saved. When there is ongoing compilation,
nothing happens."
:lighter " CoS"
(if compile-on-save-mode
(progn (make-local-variable 'after-save-hook)
(add-hook 'after-save-hook 'compile-on-save-start nil t))
(remove-hook 'after-save-hook 'compile-on-save-start t)))
(defun d2-mode-set-compile-command ()
"Configure compile command for d2-mode."
(set (make-local-variable 'compile-command)
(mapconcat #'shell-quote-argument (append (list d2-location buffer-file-name) d2-flags)
" ")))
(add-hook 'd2-mode-hook '#d2-mode-set-compile-command)
(add-hook 'd2-mode-hook '#compile-on-save-mode)
(add-hook 'image-mode-hook '#auto-revert-mode) |
add watch support for d2 diagrams. spins up server which you can go to the browser for
The text was updated successfully, but these errors were encountered: