Function: sgml-tags-invisible

sgml-tags-invisible is an interactive and byte-compiled function defined in sgml-mode.el.gz.

Signature

(sgml-tags-invisible ARG)

Documentation

Toggle visibility of existing tags.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/sgml-mode.el.gz
(defun sgml-tags-invisible (arg)
  "Toggle visibility of existing tags."
  (interactive "P")
  (let ((inhibit-read-only t)
	string)
    (with-silent-modifications
      (save-excursion
        (goto-char (point-min))
        (if (setq-local sgml-tags-invisible
                        (if arg
                            (>= (prefix-numeric-value arg) 0)
                          (not sgml-tags-invisible)))
            (while (re-search-forward sgml-tag-name-re nil t)
              (setq 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)
                                 (progn (forward-list) (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)))))
    (cursor-sensor-mode (if sgml-tags-invisible 1 -1))
    (run-hooks 'sgml-tags-invisible-hook)
    (message "")))