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:
parent
8ebb5f690c
commit
e65f201e72
|
@ -108,6 +108,11 @@
|
||||||
:type '(repeat string)
|
:type '(repeat string)
|
||||||
:group 'plantuml)
|
: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
|
(defcustom plantuml-suppress-deprecation-warning t
|
||||||
"To silence the deprecation warning when `puml-mode' is found upon loading."
|
"To silence the deprecation warning when `puml-mode' is found upon loading."
|
||||||
:type 'boolean
|
: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))))
|
(let ((original-position-eol (- (line-end-position) (point))))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(beginning-of-line)
|
(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
|
;; restore position in text of line
|
||||||
(goto-char (- (line-end-position) original-position-eol))))
|
(goto-char (- (line-end-position) original-position-eol))))
|
||||||
|
|
|
@ -166,7 +166,7 @@ the position of | in AFTER."
|
||||||
|
|
||||||
;; use 2 spaces instead of one tab for indentation
|
;; use 2 spaces instead of one tab for indentation
|
||||||
(setq-local indent-tabs-mode nil)
|
(setq-local indent-tabs-mode nil)
|
||||||
(setq-local tab-width 2)
|
(setq-local plantuml-tab-width 2)
|
||||||
(indent-according-to-mode)
|
(indent-according-to-mode)
|
||||||
|
|
||||||
(should (equal expected-state (buffer-string)))
|
(should (equal expected-state (buffer-string)))
|
||||||
|
|
|
@ -61,7 +61,7 @@ Finally, the indented text in the buffer will be compared with AFTER."
|
||||||
(plantuml-mode)
|
(plantuml-mode)
|
||||||
;; use 2 spaces instead of one tab for indentation
|
;; use 2 spaces instead of one tab for indentation
|
||||||
(setq-local indent-tabs-mode nil)
|
(setq-local indent-tabs-mode nil)
|
||||||
(setq-local tab-width 2)
|
(setq-local plantuml-tab-width 2)
|
||||||
|
|
||||||
(indent-region (point-min) (point-max))
|
(indent-region (point-min) (point-max))
|
||||||
(should (equal (buffer-string) after))))
|
(should (equal (buffer-string) after))))
|
||||||
|
|
Loading…
Reference in New Issue