all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Command in nxml-mode to show the current place in the structure (path)?
@ 2006-05-17 14:52 arndt.jonasson
  2006-05-17 16:02 ` Command in nxml-mode to show the current place in the structure(path)? Drew Adams
  2006-05-17 17:55 ` Command in nxml-mode to show the current place in the structure (path)? Lennart Borgman
  0 siblings, 2 replies; 6+ messages in thread
From: arndt.jonasson @ 2006-05-17 14:52 UTC (permalink / raw)


I've recently started using nxml-mode, and one function I quickly
felt a need for is one which compactly indicates where in the
structure we currently are. For example,

<e>
  <a>
     <b>
      oh
     </b>
     <c/>
     <d>
          point is here
     </d>
  </a>
</e>

The command in question should show something like /e/a/d, i.e.,
an XML path to the current element. Has anyone written such a
function? Actually, I just did myself, but it feels like a rough and
error-prone attempt. Since it's very small, I'll enclose it here:

(defun show-xml-path (arg)
  "Shows the names of all elements enclosing point, in the echo area."
  (interactive "*P")
  (let ((q ""))
    (nxml-ensure-scan-up-to-date)
    (setq q "")
    (condition-case ()
	(save-excursion
	  (while t
	    (nxml-backward-up-element)
	    (setq q (concat (xmltok-start-tag-qname) "/" q))))
      (error (message q)))))

I know there is a mailing-list for nxml-mode, but searching it didn't
turn up anything like this.

/Arndt Jonasson

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-05-18  8:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-17 14:52 Command in nxml-mode to show the current place in the structure (path)? arndt.jonasson
2006-05-17 16:02 ` Command in nxml-mode to show the current place in the structure(path)? Drew Adams
2006-05-17 18:02   ` Lennart Borgman
2006-05-17 17:55 ` Command in nxml-mode to show the current place in the structure (path)? Lennart Borgman
2006-05-18  8:16   ` Florent Georges
2006-05-18  8:30     ` Florent Georges

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.