Have `sgml-attribute-offset' control SGML attribute indentation
Fixes: debbugs:20161 * textmodes/sgml-mode.el (sgml-attribute-offset): New defcustom. (sgml-calculate-indent): Use `sgml-attribute-offset' for attribute indentation.
This commit is contained in:
parent
70a8bbe443
commit
f4c23f4583
3 changed files with 41 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2015-03-22 Jackson Ray Hamilton <jackson@jacksonrayhamilton.com>
|
||||
|
||||
* textmodes/sgml-mode.el (sgml-attribute-offset): New defcustom.
|
||||
(sgml-calculate-indent): Use `sgml-attribute-offset' for attribute
|
||||
indentation (bug#20161).
|
||||
|
||||
2015-03-22 Dmitry Gutov <dgutov@yandex.ru>
|
||||
|
||||
* json.el (json-decode-char0): Delete this alias.
|
||||
|
|
|
@ -46,6 +46,25 @@
|
|||
:type 'integer
|
||||
:group 'sgml)
|
||||
|
||||
(defcustom sgml-attribute-offset 0
|
||||
"Specifies a delta for attribute indentation in `sgml-indent-line'.
|
||||
|
||||
When 0, attribute indentation looks like this:
|
||||
|
||||
<element
|
||||
attribute=\"value\">
|
||||
</element>
|
||||
|
||||
When 2, attribute indentation looks like this:
|
||||
|
||||
<element
|
||||
attribute=\"value\">
|
||||
</element>"
|
||||
:version "25.1"
|
||||
:type 'integer
|
||||
:safe 'integerp
|
||||
:group 'sgml)
|
||||
|
||||
(defcustom sgml-xml-mode nil
|
||||
"When non-nil, tag insertion functions will be XML-compliant.
|
||||
It is set to be buffer-local when the file has
|
||||
|
@ -1510,13 +1529,13 @@ LCON is the lexical context, if any."
|
|||
(`pi nil)
|
||||
|
||||
(`tag
|
||||
(goto-char (1+ (cdr lcon)))
|
||||
(goto-char (+ (cdr lcon) sgml-attribute-offset))
|
||||
(skip-chars-forward "^ \t\n") ;Skip tag name.
|
||||
(skip-chars-forward " \t")
|
||||
(if (not (eolp))
|
||||
(current-column)
|
||||
;; This is the first attribute: indent.
|
||||
(goto-char (1+ (cdr lcon)))
|
||||
(goto-char (+ (cdr lcon) sgml-attribute-offset))
|
||||
(+ (current-column) sgml-basic-offset)))
|
||||
|
||||
(`text
|
||||
|
|
14
test/indent/sgml-mode-attribute.html
Normal file
14
test/indent/sgml-mode-attribute.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<element attribute="value"></element>
|
||||
|
||||
<element
|
||||
attribute="value">
|
||||
<element
|
||||
attribute="value">
|
||||
</element>
|
||||
</element>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
sgml-attribute-offset: 2
|
||||
End:
|
||||
-->
|
Loading…
Add table
Reference in a new issue