GithubHelp home page GithubHelp logo

skuro / plantuml-mode Goto Github PK

View Code? Open in Web Editor NEW
473.0 473.0 90.0 11.86 MB

A major mode for editing PlantUML sources in Emacs

License: GNU General Public License v3.0

Emacs Lisp 97.83% Makefile 0.50% Shell 1.67%

plantuml-mode's Introduction

MELPA MELPA Stable CircleCI Coverage Status

PlantUML mode for Emacs

plantuml-mode in action

“Pummel me all you want," I say. "Pummel me to death, in fact. My answers will not change." The Invierno step back, frowning. "You must love her very much," he says, not unkindly.”

from The Bitter Kingdom - Fire and Thorns #3

A PlantUML major mode for Emacs.

Quick Guide

  1. Install with M-x package-install<RET>
  2. Enable mode for current buffer M-x plantuml-mode<RET>
  3. Write some PlantUML:
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
@enduml
  1. Preview diagrams with C-c C-c (plantuml-preview).

WARNING: This may send information to "https://www.plantuml.com/plantuml"! Check that plantuml-default-exec-mode is configured correctly for your use case before previewing any sensitive material.

    ;; Sample jar configuration
    (setq plantuml-jar-path "/path/to/your/copy/of/plantuml.jar")
    (setq plantuml-default-exec-mode 'jar)

    ;; Sample executable configuration
    (setq plantuml-executable-path "/path/to/your/copy/of/plantuml.bin")
    (setq plantuml-default-exec-mode 'executable)

See Execution modes for more information.

Installation

Make sure you have MELPA enabled in your emacs.d. Then, you can just

M-x package-install<RET>
plantuml-mode<RET>

Also, to enable preview you need to tell plantuml-mode where to locate the PlantUML JAR file. By default it will look for it in ~/plantuml.jar, but you can specify any location with:

M-x customize-variable<RET>
plantuml-jar-path<RET>

You can also download the latest version of PlantUML straight into plantuml-jar-path:

M-x plantuml-download-jar<RET>

Features

  • Syntax highlight
  • Autocompletion
  • Preview of buffer or region
  • [EXPERIMENTAL] Use either local JAR or remote server for preview

Enable the major mode

You can automatically enable plantuml-mode for files with extension .plantuml by adding the following to your .emacsrc:

;; Enable plantuml-mode for PlantUML files
(add-to-list 'auto-mode-alist '("\\.plantuml\\'" . plantuml-mode))

Of course, you can always enable manually the major mode by typing M-x plantuml-mode once in the desired PlantUML file buffer.

Usage

You can tell plantuml-mode to autocomplete the word before the cursor by typing M-x plantuml-complete-symbol. This will open a popup with all the available completions as found in the list of keywords given by running PlantUML with the -language flag.

To render the PlantUML diagram within Emacs, you can hit M-x plantuml-preview. This will run PlantUML and display the result in the *PLANTUML-Preview* buffer. The format used to render the diagram is automagically chosen from what's supported by your Emacs. It will be one of the following, in order of preference:

  • SVG
  • PNG
  • Unicode ASCII art

The diagram will be either created from the selected region if one is available in the current buffer, or using the whole buffer otherwise.

If you want to force a specific output format, you can customize the variable plantuml-output-type to the value you prefer.

Default key bindings

The following shortcuts are enabled by default:

C-c C-c  plantuml-preview: renders a PlantUML diagram from the current buffer in the best supported format

C-u C-c C-c  plantuml-preview in other window

C-u C-u C-c C-c plantuml-preview in other frame

Integration with org-mode

You can use plantuml-mode to edit PlantUML source snippets within an org-mode document. To do so, you need to first register it with the plantuml language:

(add-to-list
  'org-src-lang-modes '("plantuml" . plantuml))

Then you can edit a plantuml code block with plantuml-mode by hitting C-' while inside of the code block itself:

#+BEGIN_SRC plantuml
  <hit C-c ' here to open a plantuml-mode buffer>
#+END_SRC

When in the plantuml-mode buffer you can then hit again C-' to return to the original org-mode document.

Execution modes

EXPERIMENTAL

As of v1.3.0 support is added for switching execution mode. The following two modes are available:

  • jar (default) to run PlantUML as a local JAR file. This is the traditional system used by plantuml-mode
  • server (experimental) to let an instance of plantuml-server render the preview
  • executable to run PlantUML as a local executable file. This is useful if your package manager provides a executable for PlantUML.

You can customize plantuml-default-exec-mode or run plantuml-set-exec-mode from a plantuml-mode buffer to switch modes.

Configure server rendering

When selecting server execution modes, you can customize the following variable to set the server to use for rendering:

plantuml-server-url

It defaults to "https://www.plantuml.com/plantuml".

Migration from puml-mode

If you were previously using puml-mode, you should change any reference to a puml-.. variable or function to its plantuml-.. counterpart. Most notably, puml-plantuml-jar-path is now just plantuml-jar-path.

Deprecation warning

If puml-mode is still being loaded by your Emacs, a Warning will be shown any time you open a PlantUML file. This is to remind you that you are running deprecated software. If you want to suppress the (intentionally) annoying warning, you can customize the variable plantuml-suppress-deprecation-warning.

Troubleshooting

Debug messages

As of v0.6.2 the following commands have been added to help resolving problems:

plantuml-enable-debug
plantuml-disable-debug

With debug enabled, the actual command used to invoke PlantUML is printed into a buffer called *PLANTUML Messages*. You can inspect that buffer to make sure that PlantUML is properly set up, or use it to supply extra information when opening issues.

Blank previews

If you are using SVG rendering and plantuml-preview shows you an empty buffer, chances are something is wrong with the PlantUML output. While inside the preview buffer, hit C-c C-c to switch to the textual mode and see if the output is valid SVG.

Development

Development happens mostly on the develop branch, which is released on MELPA at every commit. The master branch is used to generate tags which are then released to MELPA stable.

In order to contribute to plantuml-mode make sure to:

  • agree with the GPLv3+ licencing terms as they are mandated by Emacs
  • install cask
  • always test your code and run the full test suite with cask exec ert-runner (or just by make)
  • ensure you always target develop in your pull requests

For collaborators who have merge access to the repo:

  • make sure set-version.sh is run as part of your pre-commit git hooks
  • always merge PRs on the command line
  • when releasing a new stable version, add the proper entry in the changelog within plantuml-mode.el to ensure the right version is set for plantuml-mode-version

Credits

This project stemmed from the great work of Zhang Weize, and the current code still borrows a lot from it.

Thanks to Pavel G. Koukoushkin for implementing the preview functionality. Thanks to Raymond Huang for implementing the first drop of the indentation support.

Thanks to all the awesome contributors, you rock!

See also

License

Released under the terms of GPLv3 or (at your option) any later version. See LICENSE.txt.

plantuml-mode's People

Contributors

7mamu4 avatar adl avatar alphatan avatar apemost avatar davazp avatar driftcrow avatar excalamus avatar flexw avatar g2flyer avatar j7m4 avatar joodie avatar leafac avatar lucafavatella avatar mattfidler avatar niklaseklund avatar reneschmelzer avatar rymndhng avatar skuro avatar sunhick avatar syohex avatar veilchen avatar wailo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plantuml-mode's Issues

newpage doesn't work as expected

when previewing a plantuml file contains newpage keyword, the image preview buffer contains only one image(image generated from the first part of the code), but I use command like

java -jar /path/to/plantuml.jar test.plantuml

it will generate several images according the newpage keyword correctly.

Unable to change any colors

I'm unable to change any colors in the generated sequence diagram. If I have the following in a .plantuml buffer and do C-c C-c I get a generated sequence diagram in default colors:

`skinparam BackgroundColor DarkGrey

c_ect_down_handler -> Track : handleConnectionDown
Track -> Agent : handle_connection_down
Agent -> Track : get_state
Usingskinparam monochrome true andskinparam handwritten true` does work.

I use a dark theme and want to change the colors to match the theme but nothing I've tried has any effect on the rendered image. I'm also unable to change any fonts.

can i do org-babel-execute ?

I can't execute the plantuml code insdie org src block directly.

what I mean by directly is inside the org buffer, and display the result in the #result block.

By now I can only execute the code only in separate plantuml buffer (by ctrl-c ') .

I have check the issue #53 but it doesn't help

Stop stealing focus to the preview buffer

Summary

I'm trying to keep an mostly/always visible preview next to the file I'm editing, somewhat along the lines of #65 I imagine -- I can do this with (plantuml-preview 4) and it more or less works

...except that that buffer always steals the keyboard focus so that I can't just continue editing but rather always need to manually switch back to the editing. I've tried wrapping my call in (save-current-buffer) and others but it seems plantuml is switching to the buffer only after a random delay making it ineffective in practice.

Please allow updating a preview without switching to that buffer.

puml-init fails on emacs-24+ with message `Searching for program" "success"`

Actions:

  • install puml-mode-0.6.1 from melpa
  • open somefile.uml (any)
  • M-x puml-mode

Expected Result: puml-mode start

Actual Result: puml-init fails (see **Backtrace** below).

Environment:

  1. Problem on Ubuntu 14.04 with emacs24 (which is 24.3 today) & emacs-snapshot (which is 25.1 today) packages
  2. No problem on Windows 8.1 with emacs-24.4.1

*Backtrace*

Debugger entered--Lisp error: (file-error "Searching for program" "success" "")
  call-process-region(1 1 "" "/tmp/emacsp1PrQ6" t nil "-c" "java -jar /home/kowalskif/plantuml.jar -language")
  shell-command-on-region(1 1 "java -jar /home/kowalskif/plantuml.jar -language" #<buffer  *temp*> nil nil)
  shell-command("java -jar /home/kowalskif/plantuml.jar -language" #<buffer  *temp*>)
  puml-init()
  byte-code("�\204o�\306 \210\307\310\311   \312\"\313Q!\210\314\315\311\n\312\"\316Q!\210\317\311�\312\"!\210\320\315\311\f\312\"P!\210
\321B�!\322B�\"\323B�#\324BF�$\325\326\327\"�\330\331   \"\210\330\332\n\"\210\330\333�\"\210\330\334\f\"\210\335\300\336\337#\210\340\211��\340\211��\340\211��!\340\211�\"�#\340\207" [puml-plantuml-kwdList puml-plantuml-types puml-plantuml-keywords puml-plantuml-builtins puml-plantuml-preprocessors puml-plantuml-types-regexp puml-init (lambda (def-tmp-var) (defvar puml-plantuml-types-regexp def-tmp-var)) "^\\s *\\(" regexp-opt words "\\|\\<\\(note\\s +over\\|note\\s +\\(left\\|right\\|bottom\\|top\\)\\s +\\(of\\)?\\)\\>\\|\\<\\(\\(left\\|center\\|right\\)\\s +\\(header\\|footer\\)\\)\\>\\)" (lambda (def-tmp-var) (defvar puml-plantuml-keywords-regexp def-tmp-var)) "^\\s *" "\\|\\(<\\|<|\\|\\*\\|o\\)\\(\\.+\\|-+\\)\\|\\(\\.+\\|-+\\)\\(>\\||>\\|\\*\\|o\\)\\|\\.\\{2,\\}\\|-\\{2,\\}" (lambda (def-tmp-var) (defvar puml-plantuml-builtins-regexp def-tmp-var)) (lambda (def-tmp-var) (defvar puml-plantuml-preprocessors-regexp def-tmp-var)) font-lock-type-face font-lock-keyword-face font-lock-builtin-face font-lock-preprocessor-face make-hash-table :test equal mapc #[(x) "\302�\303 #\207" [x puml-plantuml-kwdList puthash t] 4] #[(x) "\302�\303  #\207" [x puml-plantuml-kwdList puthash t] 4] #[(x) "\302�\303  #\207" [x puml-plantuml-kwdList puthash t] 4] #[(x) "\302�\303  #\207" [x puml-plantuml-kwdList puthash t] 4] put risky-local-variable t nil puml-plantuml-keywords-regexp puml-plantuml-builtins-regexp puml-plantuml-preprocessors-regexp puml-font-lock-keywords] 6)
  command-execute(puml-mode record)
  execute-extended-command(nil "puml-mode")
  call-interactively(execute-extended-command nil nil)

Bug: C-c C-c create preview for the previous plantuml snippet even though it is comment block

When I edit a file contains @startuml ...@enduml and use C-c C-c(plantuml-preview) to preview the file, it will generate a image buffer, that is OK.

But if I comment the current block (with /' ...'/) , and write a new @startuml ...@enduml block, C-c C-c to preview, it will generate an image for the comment block above the non-commented block.

  • If I use plantuml-preview-region inside the non-commented block, it works correctly and generate a right image.
  • If I remove the commented block, C-c C-c works correctly and generate a right image.

So C-c C-c (plantuml-preview) doesn't work for a file contains more then one @startuml ...@enduml blocks even thought other such blocks except one are commented out?

Symbol's value as variable is void: plantuml-mode-hook or plantuml-mode-map

Problem 1. I'm trying to bind a key in plantuml-mode using this:

(define-key plantuml-mode-map (kbd "C-c C-v" 'plantuml-preview)

But after I restart my Emacs, it says:

Symbol's value as variable is void: plantuml-mode-hook

So I cannot use plantuml-mode-map to customize plantuml-mode?


Problem 2. I'm trying to bind a key in plantuml-mode using this:

 (bind-keys :map plantuml-mode-hook
		   ("C-c C-v" . plantuml-preview-region))

But after I restart my Emacs, it says:

Symbol's value as variable is void: plantuml-mode-hook

So I cannot use plantuml-mode-hook to customize plantuml-mode?


UPDATE:

If I require the plantuml-mode package first, the first problem will be gone, but I still cannot use plantuml-mode-hook, it says:

Warning (initialization): An error occurred while loading `/home/chz/.emacs.d/init.elc':

Wrong type argument: keymapp, (plantuml-deprecation-warning)

Save generated diagrams to file

Taking the discussion from #39, which introduced both a way to store the generated diagrams into files and open a browser to view the graphics.

Save to a file

That's a very good addition, it can definitely help out folks and keep the generated diagrams somewhere when needed. But as in your implementation you use custom variables, they become global state which would result in the same file being ovewritten in case more than one PlantUML file is being worked on at the same time. I would rather have the output file being setup on a per-buffer basis, using browser tabs to switch to the generated diagram of interest.
My point is that saving files can be a broader thing than just preview: you could store them into some git tree, your website static/ folder, etc. You need different diagrams to output in different paths.

Manage the browser

It feels to me like taking control over the browser is stretching plantuml-mode responsibilities too far. I can expect users to mostly use web browsers or emacs itself for preview, but I can still see too much variation in people setups to make plantuml-start-external-browser more of a maintenance hell then an added value (thinking here of FF + Chrome + Safari + IE, plus versions).
Once the diagram is saved to a file, people who prefer other apps than emacs have a quick way to open up their favorite viewer. I'd leave plantuml-mode to optimize for emacs preview and leave it to the user to make his/her own workflow with a different app.

Document integration with org-src for C-' editing

Hi.

May I suggest to add to the documentation that it's possible to use puml-mode from withing org-mode with C-' when the following was done:
(add-to-list 'org-src-lang-modes '("plantuml" . puml))

Hope this helps.

Remove the bin/plantuml.jar from the project.

Summary

It's might not be a good idea to put plantuml.jar in the package.
Some reasons for that:

  1. Every time plantuml.jar updates, this package needs update.
  2. Some emacs package managers use git to get the package, including jar makes git clone take a long time.

We should better just give a download link in README.md, that will be convenient enough for users.

http://plantuml.com/download

Enable PNG preview

The preview functionality doesn't work with PNG for unknown reasons. Current status and understanding of the issue:

  • the preview buffer is properly populated with binary PNG content
  • when invoking (image-mode) on the preview buffer, it results in an empty buffer
  • when hitting C-c C-c on such an empty buffer, the PNG binary content is properly rendered as texs
  • when opening a PlantUML generated PNG from a regular file it's properly displayed
  • nothing relevant is found in *Messages*

puml-plantuml-jar-path 被转义导致出错。

1、必须在加载前设置好 puml-plantuml-jar-path ,否则出错。

2、我在emacs配置文件中设置了
(setq puml-plantuml-jar-path (locate-file "plantuml.jar" exec-path))
得到实际值为 f:/msys64/opt/bin/plantuml.jar
然后编辑准备C-c C-c生成图时,导致出错:
Error: Unable to access jarfile f:/msys64/opt/bin/plantuml.jar

查看代码,发现是 (shell-quote-argument puml-plantuml-jar-path) 导致转义,能否去掉 shell-quote-argument ?

Package missing from Melpa

Summary

This package is missing from melpa. Can you publish this please? It will make installations really easy.

just sharing a patch to preview the result in a "coolish way"

Hello,

On the current version of the mode, if I press C-c, it creates a new buffer and render the result filling all my screen.
As I would have love the approach shown here where the rendering result appear on the right side of the screen and can be update (by pressing C-c again) or close (by pressing q), I made a few changes to the source code.

Here it is.
Nothing fancy, just using the display-buffer function from emacs and update the relevant code to make it works properly.

I have this patch in puml-mode since a few weeks and it works ok.

Unable to Preview using Mac Emacs 25.1

Environment

  • PlantUML.jar is successfully installed with manual invoke OK
  • Mac 10.11.5
  • GNU Emacs 25.1.50.1 (x86_64-apple-darwin15.2.0, NS appkit-1404.34 Version 10.11.2 (Build 15C50))

The configuration is as following:

;; Enable puml-mode for PlantUML files
(setq puml-plantuml-jar-path "Users/myname/bin/plantuml.jar")
(require 'puml-mode)
(add-to-list 'auto-mode-alist '("\\.puml\\'" . puml-mode))
(add-to-list 'auto-mode-alist '("\\.plantuml\\'" . puml-mode))

When preview with C-c C-c it shows error message:

error in process sentinel: if: PUML Preview failed: exited abnormally with code 1

Support for new features of plantuml

Summary

There are new features such as @startmindmap ... @endmindmap which is very useful, but plantuml-mode doesn't support it, any plans?

Checklist for pull requests

  • [] I'm fine with my code being released under the GPLv2 license
  • [] the pull request is filed against the develop branch instead of master

[Question] org-babel not exec plantuml

Guys help me pls with a problem. i'm try using planuml-mode in org-babel and can't execute next code from example%

#+begin_src plantuml :file tryout.png
  Alice -> Bob: synchronous call
  Alice ->> Bob: asynchronous call
#+end_src

#+results:
file:tryout.png

And receive Evaluation of this plantuml code block is disabled. What i do wrong?
And what is strange i can't find function org-babel-execute:plantuml in emacs (described here)

Support for indentation

If you have this code:

@startuml

participant API
participant Instance

alt deploy success
    Instance -> API: Deploy successful
else deploy failure
    Instance -> API: Deploy failed
else deploy timeout
    Instance -> API: Deploy failed
end

@enduml
  1. Move to start of alt block.
  2. Press C-SPC.
  3. Move to end of alt block.
  4. Press M-C-\ to reformat block.

Expected: The cases should stay indented.
Actual : The cases lose their indentation and ends up on the same column as
the other parts.

I discovered this since I am using the agressive-indentation mode which
reformats the code all the time.

Adding completion-at-point support (company-capf)

Is it possible to add completion-at-point support for plantuml? Or is this already implemented and I was just not able to get it working?

Looks like this should work, not really sure if this is the right way to implement it (taken from https://emacs.stackexchange.com/a/15277/19819, https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion-in-Buffers.html and elisp-mode.el):

(defun my-plantuml-completion-at-point ()
  "Function used for `completion-at-point-functions' in `plantuml-mode'."
  (let ((completion-ignore-case t) ; Not working for company-capf.
        (bounds (bounds-of-thing-at-point 'symbol))
        (keywords plantuml-kwdList))
    (when (and bounds keywords)
      (list (car bounds)
            (cdr bounds)
            keywords
            :exclusve 'no
            :company-docsig #'identity))))

Then add a hook on mode init, should be added to (define-derived-mode plantuml-mode prog-mode "plantuml" ...:

(add-hook 'completion-at-point-functions
            #'plantuml-completion-at-point nil 'local)

Then completion-at-point is supported in plantuml-mode. And this also makes company-capf work:

image

For some reason ignoring case with my solution works with completion-at-point but company stays case-sensitive unless using (setq-local completion-ignore-case t).

plantuml preview failed exited abnormally with code 1

Summary

I see issue #10 and I have same problem so instead waking up old issue, I create this new issue since my configuration different. This is my configuration:

  • OS: arch linux
  • emacs 25.3.1 with spacemacs 0.200.13
  • plantuml version: 1.2018.01
  • plantuml path: /usr/bin/plantuml
  • plantuml-jar-path and org-plantuml-jar-path variables set to /usr/bin/plantuml

The full error when running preview:

error in process sentinel: PLANTUML Preview failed: exited abnormally with code 1

Need GPLv3+ compatible license.

This package is being removed from MELPA because it doesn't currently have a license compatible with GPLv3 and later because Emacs is currently licensed with GPLv3 which is not compatible with older versions unless explicitly stated in the copyright header. Sorry for the inconvenience. More information is below.

Once properly copyrighted please send a PR to MELPA to have the package reinstated.

Assuming that you want to release under "the GPL v3 or any later version", the best way to do that would be to add this permission statement to the library header:

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also consider adding a LICENSE file containing the text of the GPL-3. You could add just that file without also adding the above persmission statement, but if you do that, then the "or (at your option) any later version" bit won't be known. So I recommend that you add both the actual license and the permission statement.

If you find the permission statement to be too noisy, then you could instead add one of these following lines to the header. If you do that, then it becomes more important to also add the LICENSE file - a judge might decide that such a line by itself is not sufficient. Still, adding just such a line is better than not specifing the license at all.

;; License: GNU General Public License version 3, or (at your option) any later version
;; License: GNU General Public License version 3, or any later version
;; License: GNU GPL version 3, or (at your option) any later version
;; License: GPL version 3, or (at your option) any later version
;; License: GPL version 3, or any later version
;; License: GPL v3, or (at your option) any later version
;; License: GPL v3, or any later version
;; License: GPL-3+

Fail to get picture result unless I run Emacs as root

If I run Emacs as root, I can get the picture after I press "C-c C-c".
But if I run Emacs as a normal role, I will just get a blank square in plantuml preview mode.
It's strange. Does some command need root privilege when producing the result?

Emacs version : 24.4.1
Java -version :
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)

The preview error on Unicode character

Summary

When using plantuml preview, the SVG file contains syntax error because of Unicode characters. This does not happen when using command line to run the plantuml.jar file.

Unable to modify variable plantuml-java-args

Summary

Hi!

Thank you skuro for a great package, I am using your plantuml-mode in my daily work :). Recently there has been some changes to a couple of plantuml files so in order to build them one must provide the path to the project root.

I wanted to make so I could continue working with those files using Emacs and not have to rely upon the terminal to build those files. So I found the variable plantuml-java-args.

I decided first to add the following to my emacs.d confifguration:

(add-to-list 'plantuml-java-args "Dplantuml.include.path=path_to_project_root")

But it didn't seem to have any effect.

Then I started looking into the plantuml.el file and found this part

(eval-and-compile
  (defcustom plantuml-java-args (list " "-Djava.awt.headless=true" "-jar")
    "The parameters passed to `plantuml-java-command' when executing PlantUML."
    :type '(repeat string)
    :group 'plantuml))

Now my elisp knowledge is not that great so I am not entirely sure I understand the need for the eval-and-compile here, but it seems like it makes it not possible for me to change this variable after it has been compiled.

I have gotten around the issue in two ways either by modifying the source code and add my path to the defcustom part above and compile the code. Or to change the source code to remove the eval-and-compile and then ad the add-to-list in my configuration.

Could you provide input on how I could solve this in any other way then having to hack into the source code? Ideally it would be great if I could modify the java-args by using the add-to-list so that I could utilize that in a dir-locals.el since this argument is project specific :)

Bug: C-c C-c create preview for the previous plantuml snippet even though it is commmtend block

When I edit a file contains @startuml ...@enduml and use C-c C-c(plantuml-preview) to preview the file, it will generate a image buffer, that is OK.

But if I comment the current block (with /' ...'/) , and write a new @startuml ...@enduml block, C-c C-c to preview, it will generate an image for the comment block above the non-commented block.

  • If I use plantuml-preview-region inside the non-commented block, it works correctly and generate a right image.
  • If I remove the commented block, C-c C-c works correctly and generate a right image.

So C-c C-c (plantuml-preview) doesn't work for a file contains more then one @startuml ...@enduml blocks even thought other such blocks except one are commented out?

Proper preview support for Windows users

As mentioned in #10, puml-mode fails to render diagrams when running on Windows due to the different path management it requires.

Provide a fix that doesn't require end users to implement dirty hacks.

Cannot set plantuml-set-exec-mode to jar

Summary

I am running M-x plantuml-set-exec-mode RET jar RET
I am getting the following error:
command-execute: Wrong type argument: listp, "jar"

M-x plantuml-set-exec-mode RET server RET
also fails with a different error:
command-execute: Wrong type argument: sequencep, server

What am I doing wrong?

plantuml-mode plantuml-mode 20190531.853 from MELPA

hide the plantuml logo on startup

Currently, every time you start plantuml-mode and every time you preview some diagram, plantuml is executed and overlays some logo on the screen during its execution. This logo is very annoying to me, and I do not want to see it.

One way to prevent it is to replace java -jar plantuml.jar by java -Djava.awt.headless=true -jar plantuml.jar. However I cannot just do (setq plantuml-java-command "java -Djava.awt.headless=true") because that variable is passed straight to start-process which will complain that there is no such a program. So the flags need to be separate.

Would it be reasonable to introduce

(defvar plantuml-java-flags "-Djava.awt.headless=true" "Extra flags to pass to java")

and use it in the two places where plantuml-java-command is used?

support for newpage

Is it possible to support the 'newpage' command of plantuml in preview buffer ?

In version 1.2.3, it's only showing the first page in the *PLANTUML Preview* buffer.
Is it possible to support the 'newpage' command to show multiple page in the preview buffer?
example code:

@startuml


title page1

newpage 
title page2



@enduml

The result only shows 'page1'

Maybe it could consider following options:

  1. Generate all pages and concatenate all into one buffer
  2. Generate different pages in diffrent buffers.

Thanks,

Checklist for pull requests

  • I'm fine with my code being released under the GPLv2 license
  • the pull request is filed against the develop branch instead of master

Provide yasnippets

yasnippet provides a way to complete snippets of code given a keyword under the cursor.

Provide out of the box snippets for all diagram types.

Indentation fails

After the latest update, a line will be pushed to the very left when pressing the return key.

I suspect it's due to the incorporation of indentation stuff.

Question: "Some diagram description contains errors"

Summary

When I generate with C-c C-c (or any other way) I get on the buffer where the image should present:

ERROR
0
Empty description
Some diagram description contains errors

note that generating the image is fine with: C-c C-e then export to html.

Write here the summary of your changes

Checklist for pull requests

  • I'm fine with my code being released under the GPLv2 license
  • the pull request is filed against the develop branch instead of master

plantuml-preview generates octal escape sequences instead of an ascii diagram

plantuml-preview generates the following in emacs 25.3.1 when emacs is launched with -nw:

     \342\224\214\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\220           \342\224\214\342\224\200\342\224\200\342\224\200\342\224\220                                                                   
     \342\224\202Alice\342\224\202           \342\224\202Bob\342\224\202                                                                                                                                                           
     \342\224\224\342\224\200\342\224\200\342\224\254\342\224\200\342\224\200\342\224\230           \342\224\224\342\224\200\342\224\254\342\224\200\342\224\230                                                                   
        \342\224\202    "test."     \342\224\202                                                                                                                                                                                   
        \342\224\202\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200>\342\224\202              
        \342\224\202                \342\224\202                                                                                                                                                                                   
        \342\224\202"Hello, Alice!" \342\224\202                                                                                                                                                                                   
        \342\224\202<\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\202              
     \342\224\214\342\224\200\342\224\200\342\224\264\342\224\200\342\224\200\342\224\220           \342\224\214\342\224\200\342\224\264\342\224\200\342\224\220                                                                   
     \342\224\202Alice\342\224\202           \342\224\202Bob\342\224\202                                                                                                                                                           
     \342\224\224\342\224\200\342\224\200\342\224\200\342\224\200\342\224\200\342\224\230           \342\224\224\342\224\200\342\224\200\342\224\200\342\224\230                                                                   

Without -nw, I get an image.

Is there a known fix?

plantuml-java-args ignored

I need to use a proxy to get access to the internet, so I need to tell java how to do so (as I'm trying to use AWS-PlantUML).

As such, I have this in my configuration:

(add-to-list 'plantuml-java-args "-Dhttps.proxyHost=127.0.0.1")
(add-to-list 'plantuml-java-args "-Dhttps.proxyPort=3129")))

Doing C-h v plantuml-java-args shows that the list is indeed being updated.

Running plantuml-preview on a simple PlantUML diagram works. However, even this one hangs:

@startuml
!includeurl https://raw.githubusercontent.com/milo-minderbinder/AWS-PlantUML/release/17-10-18/dist/common.puml

Alice -> Bob: test
@enduml

If I run list-processes, I get:

PLANTUML        run     *PLANTUML Pr... --           java -Djava.awt.headless=true -jar /Users/ivan/.nix-profile/lib/plantuml.jar -tpng -charset UTF-8 -p

That is, the extra arguments I added to plantuml-java-args are not appearing in the argument list.

auto-indentation jumps to the previous line

Summary

When using auto-indentation, the cursor appears to jump to the previous line

funkiness

Checklist for pull requests

  • I'm fine with my code being released under the GPLv2 license
  • the pull request is filed against the develop branch instead of master

Unable to access to jar file

Summary

Hi,
Whenever opening a plantuml file, it shows "Error : Unable to access to jar file ..."

I didn't change anything except this


(use-package plantuml-mode
     :ensure t
      :init
       (setq plantuml-jar-path "~/.emacs.d/orgtools/plantuml.jar")
      :config
      (add-to-list 'auto-mode-alist '("\\.uml\\'" . plantuml-mode))
      (add-to-list 'auto-mode-alist '("\\.plantuml\\'" . plantuml-mode))
  )

However I could launch it without any problem in a terminal.
Could you let me know what could be the problem on opening uml files in Emacs, please??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.