Skip to content

Commit

Permalink
Added two new functions for nxml: jump to opening/closing tag
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.code.sf.net/p/daps/svn/trunk/daps@4500 2c1a2506-8097-4b87-b405-3e90b480097b
  • Loading branch information
fsundermeyer committed Feb 13, 2015
1 parent 655eea6 commit c949d3c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions misc/docbook_macros.el
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,38 @@
(docbook-menu nxml-mode-map)
)
)

;;Two custom functions for nxml:
;; nxml-jump-opening-tag (C-c C-c <up>) :
;; Jump to the openening tag that fits the context at point and put
;; the cursor at the beginning of the tag name.
;;
;; nxml-jump-closing-tag (C-c C-c <down>):
;; Jump to the closing tag that fits the context at point and put
;; the cursor at the beginning of the tag name.
;;
(add-hook 'nxml-mode-hook
'(lambda ()
(autoload 'sgml-skip-tag-forward "sgml-mode"
"Skip to end of tag or matching closing tag if present.
With prefix argument ARG, repeat this ARG times.
Return t if after a closing tag." t)
;; Custom functions for nxml
;;
(defun nxml-jump-opening-tag nil
"Jump to the openening tag that fits the context at point and put the cursor at the beginning of the tag name."
(interactive)
(nxml-backward-up-element)
(forward-char)
)
(defun nxml-jump-closing-tag nil
"Jump to the closing tag that fits the context at point and put the cursor at the beginning of the tag name."
(interactive)
(nxml-backward-up-element)
(sgml-skip-tag-forward 1)
(backward-word)
)
(define-key nxml-mode-map (kbd "C-c C-c <up>") 'nxml-jump-opening-tag)
(define-key nxml-mode-map (kbd "C-c C-c <down>") 'nxml-jump-closing-tag)
)
)

0 comments on commit c949d3c

Please sign in to comment.