Update local copy of plantuml-mode

This is now at e7c08c588b/plantuml-mode.el.
master
Daniel Borchmann 1 year ago
parent 0723f45769
commit b4621122cc
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
  1. 24
      site-lisp/plantuml-mode.el

@ -552,11 +552,7 @@ Uses prefix (as PREFIX) to choose where to display it:
(cl-defgeneric plantuml-export-string-to-buffer (exec-mode string buffer)
"Export STRING to plantuml diagram using the given EXEC-MODE.
Use BUFFER to write the diagram to, clearing it first. This
buffer can be written to a file or be displayed directly.")
(cl-defmethod plantuml-export-string-to-buffer (exec-mode string buffer)
"Fallback method when EXEC-MODE is unknown.
STRING and BUFFER are ignored."
buffer can be written to a file or be displayed directly."
(ignore string buffer)
(user-error "Exporting with exec-mode %s is not supported (yet)" exec-mode))
@ -615,7 +611,15 @@ only the region will be exported."
(message "Exporting to %s ..." export-file-name)
(let ((target-buffer (generate-new-buffer " *temp*")))
;; If there's already a buffer visiting that file, use that for the export;
;; otherwise create a new buffer.
(let ((target-buffer (or (find-buffer-visiting export-file-name)
(generate-new-buffer " *temp*"))))
;; When the buffer is in image-mode, erasing it's contents is not
;; possible, even when disabling `read-only-mode' explicitly. Let's just
;; switch to `fundamental-mode' to keep things simple.
(with-current-buffer target-buffer
(fundamental-mode))
;; We do not use `with-temp-buffer' here, as we want to stay in the
;; current buffer containing the plantuml diagram. The reason for this is
;; that `planumlt-output-type' is local to the current buffer, and
@ -632,7 +636,13 @@ only the region will be exported."
;; format bit by bit.
(with-current-buffer target-buffer
(let ((coding-system-for-write 'binary))
(write-file export-file-name))))
;; When exporting, we do not want to display the image in Emacs
;; itself; as rendering the image in Emacs may take a significant
;; amount of time, we try to inhibit the automatic image display
;; by binding `image-mode' to `image-mode-as-text'
(let ((auto-mode-alist nil)
(magic-fallback-mode-alist nil))
(write-file export-file-name)))))
(if errors-during-export
(message "Exporting to %s ... failed (see file for details)" export-file-name)

Loading…
Cancel
Save