2016-10-14 14:03:30 +02:00
|
|
|
;; Graphviz' dot
|
2013-06-26 23:51:38 +02:00
|
|
|
|
2013-06-26 23:53:56 +02:00
|
|
|
(setq graphviz-dot-preview-extension "pdf")
|
|
|
|
(defcustom graphviz-dot-view-extension "pdf"
|
|
|
|
"Graphviz format for external view."
|
2017-05-11 19:38:01 +02:00
|
|
|
:type 'string)
|
2013-06-26 23:53:56 +02:00
|
|
|
(setq graphviz-dot-view-command "zathura --fork %s")
|
|
|
|
|
2013-06-26 23:51:38 +02:00
|
|
|
;; Override original stupid function.
|
|
|
|
(add-hook
|
|
|
|
'graphviz-dot-mode-hook
|
|
|
|
(lambda ()
|
|
|
|
(defun graphviz-dot-view ()
|
|
|
|
"Runs an external viewer. This creates an external process every time it
|
|
|
|
is executed. If `graphviz-dot-save-before-view' is set, the current
|
|
|
|
buffer is saved before the command is executed."
|
|
|
|
(interactive)
|
2017-05-24 00:27:02 +02:00
|
|
|
(let* ((default-cmd (format graphviz-dot-view-command
|
|
|
|
(concat (file-name-sans-extension buffer-file-name)
|
|
|
|
"." graphviz-dot-view-extension)))
|
|
|
|
(cmd (if graphviz-dot-view-edit-command
|
|
|
|
(read-from-minibuffer "View command: " default-cmd)
|
|
|
|
default-cmd)))
|
|
|
|
(when graphviz-dot-save-before-view
|
|
|
|
(save-buffer))
|
2013-06-26 23:51:38 +02:00
|
|
|
(setq novaproc (start-process-shell-command
|
|
|
|
(downcase mode-name) nil cmd))
|
|
|
|
(message (format "Executing `%s'..." cmd))))))
|
|
|
|
|
2014-02-12 17:48:29 +01:00
|
|
|
(provide 'mode-dot)
|