diff options
author | Ulrich Müller <ulm@gentoo.org> | 2022-06-05 11:44:21 +0200 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2022-06-05 11:44:21 +0200 |
commit | 54a775dc17a797414ee2c9a624decf0fa7d07e75 (patch) | |
tree | 5cf62f672009aecac180e6df863d6593f250d188 | |
parent | Add loong to default list of archs (diff) | |
download | ebuild-mode-54a775dc17a797414ee2c9a624decf0fa7d07e75.tar.gz ebuild-mode-54a775dc17a797414ee2c9a624decf0fa7d07e75.tar.bz2 ebuild-mode-54a775dc17a797414ee2c9a624decf0fa7d07e75.zip |
Indent XML with tabs or two spaces
* ebuild-mode.el (ebuild-repo-mode): Indent XML with tabs or two
spaces. Set indent-tabs-mode accordingly.
(ebuild-mode-xml-indent-tabs): New custom variable.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ebuild-mode.el | 12 |
2 files changed, 17 insertions, 1 deletions
@@ -1,3 +1,9 @@ +2022-06-05 Ulrich Müller <ulm@gentoo.org> + + * ebuild-mode.el (ebuild-repo-mode): Indent XML with tabs or two + spaces. Set indent-tabs-mode accordingly. + (ebuild-mode-xml-indent-tabs): New custom variable. + 2022-06-03 Ulrich Müller <ulm@gentoo.org> * ebuild-mode.el (ebuild-mode-arch-list): Add loong to default. diff --git a/ebuild-mode.el b/ebuild-mode.el index cea3576..ac01f23 100644 --- a/ebuild-mode.el +++ b/ebuild-mode.el @@ -114,6 +114,12 @@ If nil, don't update." :type 'boolean :group 'ebuild) +(defcustom ebuild-mode-xml-indent-tabs nil + "If non-nil, use tab characters for indenting of XML. +If nil, use two spaces." + :type 'boolean + :group 'ebuild) + ;; Predicate function for comparison of architecture keywords ;; (needed for variable definitions below) (defun ebuild-mode-arch-lessp (a b) @@ -620,7 +626,11 @@ and `all-completions' for details." (make-local-hook 'write-contents-hooks) (add-hook 'write-contents-hooks 'ebuild-repo-mode-before-save t t)) (setq fill-column 72) - (setq tab-width 4)) + (setq tab-width 4) + (when (derived-mode-p 'nxml-mode) + (set (make-local-variable 'nxml-child-indent) + (if ebuild-mode-xml-indent-tabs 4 2)) + (setq indent-tabs-mode ebuild-mode-xml-indent-tabs))) ;;;###autoload (defun ebuild-repo-mode-maybe-enable () |