help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Command in nxml-mode to show the current place in the structure (pat


From: Lennart Borgman
Subject: Re: Command in nxml-mode to show the current place in the structure (path)?
Date: Wed, 17 May 2006 19:55:25 +0200
User-agent: Thunderbird 1.5.0.2 (Windows/20060308)

arndt.jonasson@gmail.com wrote:
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

Maybe you will have more luck asking this on the nxml-mode mailing list?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]