Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(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 ()
(message "PLANTUML Start rendering")
(shell-command (concat "java -jar ~/Downloads/plantuml.jar "
(message (concat "PLANTUML Rendered: " (buffer-name))))
;; Image reloading
(defun reload-image-at-point ()
(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 ()
(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))

This comment has been minimized.

Copy link

@papoanaya papoanaya commented Jun 14, 2012

One thing I would like to modify this code is to work for an emacs region in addition to the whole buffer. This probably would entail either creating a temporary file or sending it to sysinput. We'll see, I'll dabble with it whenever I get a chance. But it works well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment