Function: markdown-ts-toc-update-before-save-mode

markdown-ts-toc-update-before-save-mode is an autoloaded, interactive and byte-compiled function defined in markdown-ts-mode-x.el.gz.

Signature

(markdown-ts-toc-update-before-save-mode &optional ARG)

Documentation

If enabled, update markdown-ts-mode tables of contents before saving.

This is a minor mode. If called interactively, toggle the Markdown-Ts-Toc-Update-Before-Save 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 markdown-ts-toc-update-before-save-mode(var)/markdown-ts-toc-update-before-save-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/markdown-ts-mode-x.el.gz
;;;###autoload
(define-minor-mode markdown-ts-toc-update-before-save-mode
  "If enabled, update `markdown-ts-mode' tables of contents before saving."
  :init-value nil
  :global nil
  :lighter markdown-ts-toc-update-before-save-mode-lighter
  (if (derived-mode-p 'markdown-ts-mode)
      (if markdown-ts-toc-update-before-save-mode
          (add-hook 'before-save-hook #'markdown-ts-toc-generate nil 'local)
        (remove-hook 'before-save-hook #'markdown-ts-toc-generate 'local))
    (setq markdown-ts-toc-update-before-save-mode nil)
    (lwarn 'markdown-ts-toc-update-before-save-mode
           :warning
           "Minor mode valid only in `markdown-ts-mode' buffers.")))