Fixed docs

This commit is contained in:
Carlo Sciolla 2016-10-10 20:35:06 +02:00
parent 0aabb908f8
commit cdee161b3d
1 changed files with 27 additions and 25 deletions

View File

@ -1,9 +1,9 @@
[![MELPA](http://melpa.org/packages/puml-mode-badge.svg)](http://melpa.org/#/puml-mode) [![MELPA Stable](http://stable.melpa.org/packages/puml-mode-badge.svg)](http://stable.melpa.org/#/puml-mode)
[![MELPA](http://melpa.org/packages/plantuml-mode-badge.svg)](http://melpa.org/#/plantuml-mode) [![MELPA Stable](http://stable.melpa.org/packages/plantuml-mode-badge.svg)](http://stable.melpa.org/#/plantuml-mode)
# PlantUML mode for Emacs
<img src="https://raw.githubusercontent.com/skuro/puml-mode/master/banner.png"
alt="puml-mode in action" title="Behold the beauty of text-based UML diagrams!" />
<img src="https://raw.githubusercontent.com/skuro/plantuml-mode/master/banner.png"
alt="plantuml-mode in action" title="Behold the beauty of text-based UML diagrams!" />
> “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.”
@ -18,78 +18,80 @@ A [PlantUML](http://plantuml.sourceforge.net/) major mode for Emacs.
Make sure you have [MELPA](http://melpa.org/) enabled in your ``emacs.d``. Then, you can just
M-x package-install<RET>
puml-mode<RET>
plantuml-mode<RET>
Also, to enable preview you need to tell `puml-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:
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>
puml-plantuml-jar-path<RET>
plantuml-plantuml-jar-path<RET>
# Features
- Syntax highlight
- Autocompletion
- Preview
- Preview of buffer or region
# Enable the major mode
You can automatically enable `puml-mode` for files with extension `.puml` or `plantuml` by adding the following to your `.emacsrc`:
You can automatically enable `plantuml-mode` for files with extension `.plantuml` or `plantuml` by adding the following to your `.emacsrc`:
;; Enable puml-mode for PlantUML files
(add-to-list 'auto-mode-alist '("\\.puml\\'" . puml-mode))
(add-to-list 'auto-mode-alist '("\\.plantuml\\'" . puml-mode))
;; Enable plantuml-mode for PlantUML files
(add-to-list 'auto-mode-alist '("\\.plantuml\\'" . plantuml-mode))
(add-to-list 'auto-mode-alist '("\\.plantuml\\'" . plantuml-mode))
Of course, you can always enable manually the major mode by typing `M-x puml-mode` once in the desired PlantUML file buffer.
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 either tell `puml-mode` to autocomplete the word before the cursor by typing `M-x puml-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.
You can either 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 also hit `M-x puml-preview`. This will run PlantUML and display the result in the `*PUML-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:
To render the PlantUML diagram within Emacs, you can also 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.
## Default key bindings
The following shortcuts are enabled by default:
C-c C-c puml-preview: renders a PlantUML diagram from the current buffer in the best supported format
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 puml-preview in other window
C-u C-c C-c plantuml-preview in other window
C-u C-u C-c C-c puml-preview in other frame
C-u C-u C-c C-c plantuml-preview in other frame
## Integration with `org-mode`
You can use `puml-mode` to edit PlantUML source snippets within an [`org-mode`](http://orgmode.org/) document. To do so, you need to first register it with the `plantuml` language:
You can use `plantuml-mode` to edit PlantUML source snippets within an [`org-mode`](http://orgmode.org/) document. To do so, you need to first register it with the `plantuml` language:
```
(add-to-list
'org-src-lang-modes '("plantuml" . puml))
'org-src-lang-modes '("plantuml" . plantuml))
```
Then you can edit a `plantuml` code block with `puml-mode` by hitting `C-'` while inside of the code block itself:
Then you can edit a `plantuml` code block with `plantuml-mode` by hitting `C-'` while inside of the code block itself:
```elisp
#+BEGIN_SRC plantuml
<hit C-' here to open a puml-mode buffer>
<hit C-' here to open a plantuml-mode buffer>
#+END_SRC
```
When in the `puml-mode` buffer you can then hit again `C-'` to return to the original `org-mode` document.
When in the `plantuml-mode` buffer you can then hit again `C-'` to return to the original `org-mode` document.
# Troubleshooting
As of `v0.6.2` the following commands have been added to help resolving problems:
```
puml-enable-debug
puml-disable-debug
plantuml-enable-debug
plantuml-disable-debug
```
With debug enabled, the actual command used to invoke PlantUML is printed into a buffer called `*PUML 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](https://github.com/skuro/puml-mode/issues).
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](https://github.com/skuro/plantuml-mode/issues).
# Credits