Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions hl-tags-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,25 @@ boundaries of the current start and end tag , or nil."
(hl-tags-context-sgml-mode)))

(defun hl-tags-update ()
(let ((ctx (hl-tags-context)))
(let* ((ctx (hl-tags-context))
(start1 (caar ctx))
(end1 (cdar ctx))
(start2 (cadr ctx))
(end2 (cddr ctx)))
(if (null ctx)
(hl-tags-hide)
(hl-tags-show)
(move-overlay hl-tags-start-overlay (caar ctx) (cdar ctx))
(move-overlay hl-tags-end-overlay (cadr ctx) (cddr ctx)))))
(move-overlay hl-tags-start-overlay start1 end1)
(move-overlay hl-tags-end-overlay start2 end2)
; display the matched tag in the minibuffer if they are off screen.
(if (hl-tag-off-screen-p start1 end1)
(message "Open tag: %s" (buffer-substring start1 end1))
(if (hl-tag-off-screen-p start2 end2)
(message "Close tag: %s" (buffer-substring start2 end2)))))))

(defun hl-tag-off-screen-p (start end)
(or (> start (window-end))
(< end (window-start))))

(defun hl-tags-show ()
(unless hl-tags-start-overlay
Expand Down