* indenting in nxml-mode
@ 2016-07-16 1:30 Joseph Mingrone
0 siblings, 0 replies; only message in thread
From: Joseph Mingrone @ 2016-07-16 1:30 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]
Hi,
I posted a question on emacs.stackexhcange.com about indenting in nxml-mode.
http://emacs.stackexchange.com/questions/24619/indent-continuation-lines-in-nxml-mode
My goal was to configure indenting to conform to the style guide described here.
https://www.freebsd.org/doc/en_US.ISO8859-1/books/fdp-primer/book.html#writing-style-guide
It seems this was not possible without some hacking.
I have given it a (very) preliminary attempt. I suspect there are cases I
haven't considered, but after some light testing, it seems to be working.
(defun nxml-compute-indent-from-matching-start-tag ()
"Compute the indent for a line using the matching start-tag."
(save-excursion
(back-to-indentation)
(nxml-token-after)
(let ((bol (point)) (bol-xmltok-type xmltok-type))
(and
(condition-case nil
(nxml-scan-element-backward
(point) t (- (point) nxml-end-tag-indent-scan-distance))
(nxml-scan-error nil))
(< xmltok-start bol)
(progn
(goto-char xmltok-start)
(skip-chars-backward " \t")
(bolp))
(if (memq bol-xmltok-type
'(data empty-element partial-start-tag start-tag ))
(+ (current-indentation) nxml-child-indent)
(current-indentation))))))
What problems am I missing?
Joseph
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-07-16 1:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-16 1:30 indenting in nxml-mode Joseph Mingrone
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.