Function: sgml-electric-tag-pair-mode

sgml-electric-tag-pair-mode is an interactive and byte-compiled function defined in sgml-mode.el.gz.

Signature

(sgml-electric-tag-pair-mode &optional ARG)

Documentation

Toggle SGML Electric Tag Pair mode.

SGML Electric Tag Pair mode is a buffer-local minor mode for use with sgml-mode and related major modes. When enabled, editing an opening markup tag automatically updates the closing tag.

This is a minor mode. If called interactively, toggle the Sgml-Electric-Tag-Pair 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-electric-tag-pair-mode(var)/sgml-electric-tag-pair-mode(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-electric-tag-pair-mode
  "Toggle SGML Electric Tag Pair mode.

SGML Electric Tag Pair mode is a buffer-local minor mode for use
with `sgml-mode' and related major modes.  When enabled, editing
an opening markup tag automatically updates the closing tag."
  :lighter "/e"
  (if sgml-electric-tag-pair-mode
      (progn
        (add-hook 'before-change-functions
                  #'sgml-electric-tag-pair-before-change-function
                  nil t)
        (unless sgml-electric-tag-pair-timer
          (setq sgml-electric-tag-pair-timer
                (run-with-idle-timer 5 'repeat #'sgml-electric-tag-pair-flush-overlays))))
    (remove-hook 'before-change-functions
                 #'sgml-electric-tag-pair-before-change-function
                 t)
    ;; We leave the timer running for other buffers.
    ))