all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yurivkhan@gmail.com>
To: nyraghu27132@gmail.com, help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: nXML mode indentation
Date: Tue, 08 May 2018 04:55:35 +0000	[thread overview]
Message-ID: <CAP_d_8UKEPLuGQ2MoPC-fBhZ+H2UPpvNeqoebDTSAFHST3NOeA@mail.gmail.com> (raw)
In-Reply-To: <8736z2ydeq.fsf@gmail.com>

On Tue, May 8, 2018 at 11:34 AM N. Raghavendra <nyraghu27132@gmail.com>
wrote:

> > I request help regarding indentation of text that is directly inside
> > elements in nXML mode.
> I am trying to follow the XML style guidelines of the FreeBSD
> Documentation Project,


https://www.freebsd.org/doc/en_US.ISO8859-1/books/fdp-primer/writing-style-guide.html#writing-style-indentation

> and I would indeed like to use nXML mode.

> It looks like `nxml-compute-indent-from-previous-line' in nxml-mode.el
> is relevant, but I can't see how to modify or advise it.

I have customized indentation in nXML for XHTML documents. The exact
indentation rules I use are not relevant to your case but here’s how I
activate it.

See the documentation on ‘indent-line-function’ and the source of
‘nxml-indent-line’ for implementation details.

(defun yk-xhtml-indent-line ()
   "Indent the current line suitably for XHTML."
   <my custom indentation rules>)

(defun yk-xhtml-indent--maybe-enable ()
   "Set the current buffer’s indentation function
to `yk-xhtml-indent-line' if the current schema is “html”."
   (pcase (caddr rng-current-schema)
     ("html" (setq-local indent-line-function 'yk-xhtml-indent-line))))

(with-eval-after-load 'nxml-mode
   (add-hook 'nxml-mode-hook 'yk-xhtml-indent--maybe-enable))



  reply	other threads:[~2018-05-08  4:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-05 13:38 nXML mode indentation N. Raghavendra
2018-05-08  4:33 ` N. Raghavendra
2018-05-08  4:55   ` Yuri Khan [this message]
2018-05-08  5:16     ` N. Raghavendra
2018-05-08  8:09   ` N. Raghavendra
2018-05-08  8:19     ` Yuri Khan
2018-05-08 15:30       ` N. Raghavendra
2018-05-09  3:22         ` N. Raghavendra
2018-05-12  4:36           ` N. Raghavendra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP_d_8UKEPLuGQ2MoPC-fBhZ+H2UPpvNeqoebDTSAFHST3NOeA@mail.gmail.com \
    --to=yurivkhan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=nyraghu27132@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.