-
-
Save Randy1Burrell/7ed8899da46f2c73564a6103e419aa32 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
;;; plantuml_helpers.el --- Provides plantuml helper functions -*- lexical-binding: t -*- | |
;;; Commentary: | |
;; plantuml helper functions | |
;;; Code: | |
(require 'iimage) | |
(autoload 'iimage-mode "iimage" "Support Inline image minor mode." t) | |
(autoload 'turn-on-iimage-mode "iimage" "Turn on Inline image minor mode." t) | |
(add-to-list 'iimage-mode-image-regex-alist '("@startuml\s+\\(.+\\)" . 1)) | |
;; Rendering plantuml | |
(defun plantuml-render-buffer () | |
(interactive) | |
(message "PLANTUML Start rendering") | |
(shell-command (concat "java -jar ~/.emacs.d/plantuml.jar " | |
buffer-file-name)) | |
(message (concat "PLANTUML Rendered: " (buffer-name)))) | |
;; Image reloading | |
(defun reload-image-at-point () | |
(interactive) | |
(message "reloading image at point in the current buffer...") | |
(image-refresh (get-text-property (point) 'display))) | |
;; Image resizing and reloading | |
(defun resize-image-at-point () | |
(interactive) | |
(message "resizing image at point in the current buffer123...") | |
(let* ((image-spec (get-text-property (point) 'display)) | |
(file (cadr (member :file image-spec)))) | |
(message (concat "resizing image..." file)) | |
(shell-command (format "convert -resize %d %s %s " | |
(* (window-width (selected-window)) (frame-char-width)) | |
file file)) | |
(reload-image-at-point))) | |
(provide 'plantuml_helpers) | |
;;; plantuml_helpers.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment