     (if errors-during-export
         (message "Exporting to %s ... failed (see file for details)" export-file-name)
       (message "Exporting to %s ... done" export-file-name))))
+
+
++
+;; View exported files
+
+(defun plantuml-view-exported-file ()
+  "Open file exported from current plantuml-buffer in external application.
+When an exported file does not exist yet, ask whether it should
+be generated first."
+  (interactive)
+
+  (let ((export-file-name (plantuml--export-file-name)))
+
+    (when (not (file-exists-p export-file-name))
+      (if (yes-or-no-p (message "Export file %s does not exist yet, export current buffer?"
+                                export-file-name))
+          (plantuml-export export-file-name)
+        (user-error "Export file name %s does not exist yet and export has been denied, aborting"
+                    export-file-name)))
+
+    (case system-type
+      ((windows-nt) (w32-shell-execute "open" export-file-name))
+      ((cygwin) (start-process "" nil "cygstart" export-file-name))
+      (otherwise (start-process "" nil "xdg-open" export-file-name)))))
 
  

  (let ((keymap (make-sparse-keymap)))
    (define-key keymap (kbd "C-c C-c") 'plantuml-preview)
    (define-key keymap (kbd "C-c C-e") 'plantuml-export)
    keymap)
  "Keymap for plantuml-mode.")


(defcustom plantuml-indent-level tab-width
  "Indentation level of PlantUML lines")

(defcustom plantuml-confirm-overwrite-on-export t
  "Control whether file exporting is allowed to silently overwrite files."
  :type 'boolean
  :group 'plantuml)
