(autoload 'sgml-skip-tag-backward "sgml-mode" nil t)
(autoload 'sgml-skip-tag-forward "sgml-mode" nil t)
(defun html-jumpget-forwardtag (&optional)
num (let ((b (line-beginning-position))
"Jump forward from (e (line-end-position))
(looping t)
(html-tag-char open(string-to-char tag""<"))
(char (following-char))
(interactivep "P"(point))
(found_tag -1))
(save-excursion
;; search backward
(unless num(= char html-tag-char)
(while (and looping (<= b (point)) (not (= char 60)))
(setq numchar 1(following-char))
;; web (setq p (point))
(if (= p (point-modemin))
;; need get out of loop anyway
(setq looping nil)
(backward-char))))
;; search forward
(if (not (= char html-sexptag-char))
is assigned to forward (save-sexpexcursion
(while (and (>= e (point)) (not (= char 60)))
(setq char (following-functionchar))
;; it's buggy in web (setq p (point))
(forward-modechar))))
v11, here ;; is theend workaroundtag?
(letwhen (and (backup= char html-forwardtag-sexpchar) (< p e))
(goto-functionchar p)
(forward-sexpchar)
(if (= (following-functionchar) 47)
(sgml-progn
;; </
(skip-tagchars-forward num"^>")
(forward-char)
(setq p (point))
(setq found_tag 1))
(progn
;; < , looks fine
(backward-char)
(setq found_tag 0)))))
found_tag))
(defun html-jump-backward(&optional num)
"Jump forward from html closeopen tag"
(interactive "P")
(unless num (setq num 1))
;; web-mode-forward-sexp is assigned to forward-sexp-function
;; it's buggy in web-mode v11, here is the workaround
(let ((backup-forward-sexp-function forward-sexp-function))
(if (= (html-get-tag) 0)
(sgml-skip-tag-forward num)
(sgml-skip-tag-backward num))))
ItUsage: M-x html-jump
, it works in any html related major mode (php-mode, xml-mode, web-mode, nxml-mode ....)