intro of customisable plantuml-tab-width

Default is still the global tab-width. For diagrams I usually like to
have a smaller indentation (2 spaces) as I use in programming (4
spaces).

Is tested implicitly, as the variable is setq-local in test prepartions.
This commit is contained in:
René Schmelzer 2019-03-16 15:31:25 +01:00
parent 8ebb5f690c
commit e65f201e72
3 changed files with 8 additions and 3 deletions

View File

@ -108,6 +108,11 @@
:type '(repeat string)
:group 'plantuml)
(defcustom plantuml-tab-width tab-width
"The number of spaces used for indentation."
:type 'integer
:group 'plantuml)
(defcustom plantuml-suppress-deprecation-warning t
"To silence the deprecation warning when `puml-mode' is found upon loading."
:type 'boolean
@ -460,7 +465,7 @@ Restore point to same position in text of the line as before indentation."
(let ((original-position-eol (- (line-end-position) (point))))
(save-excursion
(beginning-of-line)
(indent-line-to (* tab-width (plantuml-current-block-depth))))
(indent-line-to (* plantuml-tab-width (plantuml-current-block-depth))))
;; restore position in text of line
(goto-char (- (line-end-position) original-position-eol))))

View File

@ -166,7 +166,7 @@ the position of | in AFTER."
;; use 2 spaces instead of one tab for indentation
(setq-local indent-tabs-mode nil)
(setq-local tab-width 2)
(setq-local plantuml-tab-width 2)
(indent-according-to-mode)
(should (equal expected-state (buffer-string)))

View File

@ -61,7 +61,7 @@ Finally, the indented text in the buffer will be compared with AFTER."
(plantuml-mode)
;; use 2 spaces instead of one tab for indentation
(setq-local indent-tabs-mode nil)
(setq-local tab-width 2)
(setq-local plantuml-tab-width 2)
(indent-region (point-min) (point-max))
(should (equal (buffer-string) after))))