unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Indentation in nxml-mode
@ 2010-06-06 22:56 Paul Landes
  0 siblings, 0 replies; only message in thread
From: Paul Landes @ 2010-06-06 22:56 UTC (permalink / raw)
  To: emacs-devel

When indenting in Emacs 23.2 nothing happens to the point/cursor
when hitting tab (indent-for-mode) when the line is already at
the correct indentation.  Before, the cursor would move to the
first character of the line and correct the indentation if
necessary (when the cursor was before any non-whitespace).

Is this the correct behavior now and if so, why is it now
different from every/most other modes?  If so, is there some kind
of customization to get it back?  If this is a bug, here's a
proposed fix (although it does have the side effect of NOT
correcting spaces being proceeded by tabs in some cases:

(defun nxml-indent-line ()
  "Indent current line as XML."
  (let ((indent (nxml-compute-indent))
	(from-end (- (point-max) (point))))
    (when indent
      (beginning-of-line)
      (if (= indent (current-indentation))
	  (re-search-forward "[\t ]*")
	(let ((bol (point)))
	  (skip-chars-forward " \t")
	  (delete-region bol (point)))
	(indent-to indent)
	(when (> (- (point-max) from-end) (point))
	  (goto-char (- (point-max) from-end)))))))





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-06-06 22:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-06 22:56 Indentation in nxml-mode Paul Landes

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).