Function: orgtbl-mode

orgtbl-mode is an autoloaded, interactive and byte-compiled function defined in org-table.el.gz.

Signature

(orgtbl-mode &optional ARG)

Documentation

The Org mode table editor as a minor mode for use in other modes.

This is a minor mode. If called interactively, toggle the OrgTbl 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 orgtbl-mode(var)/orgtbl-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/org/org-table.el.gz
;;;###autoload
(define-minor-mode orgtbl-mode
  "The Org mode table editor as a minor mode for use in other modes."
  :lighter " OrgTbl"
  (org-load-modules-maybe)
  (cond
   ((derived-mode-p 'org-mode)
    ;; Exit without error, in case some hook functions calls this by
    ;; accident in Org mode.
    (message "Orgtbl mode is not useful in Org mode, command ignored"))
   (orgtbl-mode
    (orgtbl-setup)
    ;; Make sure we are first in minor-mode-map-alist
    (let ((c (assq 'orgtbl-mode minor-mode-map-alist)))
      ;; FIXME: maybe it should use emulation-mode-map-alists?
      (and c (setq minor-mode-map-alist
                   (cons c (delq c minor-mode-map-alist)))))
    (setq-local org-table-may-need-update t)
    (add-hook 'before-change-functions 'org-before-change-function
	      nil 'local)
    (setq-local org-old-auto-fill-inhibit-regexp
		auto-fill-inhibit-regexp)
    (setq-local auto-fill-inhibit-regexp
		(if auto-fill-inhibit-regexp
		    (concat orgtbl-line-start-regexp "\\|"
			    auto-fill-inhibit-regexp)
		  orgtbl-line-start-regexp))
    (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords)
    (org-restart-font-lock))
   (t
    (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
    (remove-hook 'before-change-functions 'org-before-change-function t)
    (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords)
    (org-restart-font-lock)
    (force-mode-line-update 'all))))