Function: sgml-tags-invisible
sgml-tags-invisible is an interactive and byte-compiled function
defined in sgml-mode.el.gz.
Signature
(sgml-tags-invisible &optional ARG)
Documentation
Toggle visibility of existing tags.
This is a minor mode. If called interactively, toggle the
Sgml-Tags-Invisible mode mode. If the prefix argument is positive,
enable the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the mode
if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate the variable sgml-tags-invisible(var)/sgml-tags-invisible(fun).
The mode's hook is called both when the mode is enabled and when it is disabled.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/sgml-mode.el.gz
(define-minor-mode sgml-tags-invisible
"Toggle visibility of existing tags."
:global nil
(with-silent-modifications
(save-excursion
(goto-char (point-min))
(if sgml-tags-invisible
(while (re-search-forward sgml-tag-name-re nil t)
(let ((string
(cdr (assq (intern-soft (downcase (match-string 1)))
sgml-display-text))))
(goto-char (match-beginning 0))
(and (stringp string)
(not (overlays-at (point)))
(let ((ol (make-overlay (point) (match-beginning 1))))
(overlay-put ol 'before-string string)
(overlay-put ol 'sgml-tag t)))
(put-text-property (point)
(let ((forward-sexp-function nil))
(forward-sexp 1)
(point))
'category 'sgml-tag)))
(let ((pos (point-min)))
(while (< (setq pos (next-overlay-change pos)) (point-max))
(dolist (ol (overlays-at pos))
(if (overlay-get ol 'sgml-tag)
(delete-overlay ol)))))
(remove-text-properties (point-min) (point-max) '(category nil)))))
(when sgml-tags-invisible
(cursor-sensor-mode 1)))