From 0c31a4fcb6fb09e20f46d16da5ca0d24a52e6978 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 15 May 2013 16:18:37 +0200 Subject: [PATCH] org-table.el: Rename a variable and a function * org-table.el (org-table-TBLFM-begin-regexp): Rename from `org-TBLFM-begin-regexp'. (org-table-calc-current-TBLFM): Rename from `org-calc-current-TBLFM'. * org.el (org-ctrl-c-ctrl-c): Require org-table if needed. --- lisp/org-table.el | 16 ++++++---------- lisp/org.el | 4 +++- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 8e461c8e7..cd7609d16 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -52,7 +52,7 @@ This can be used to add additional functionality after the table is sent to the receiver position, otherwise, if table is not sent, the functions are not run.") -(defvar org-TBLFM-begin-regexp "|\n[ \t]*#\\+TBLFM: ") +(defvar org-table-TBLFM-begin-regexp "|\n[ \t]*#\\+TBLFM: ") (defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized) "Non-nil means use the optimized table editor version for `orgtbl-mode'. @@ -3174,8 +3174,8 @@ with the prefix ARG." (setq checksum c1))) (user-error "No convergence after %d iterations" imax)))))) -(defun org-calc-current-TBLFM (&optional arg) - "Apply the #+TBLFM in the line to the table." +(defun org-table-calc-current-TBLFM (&optional arg) + "Apply the #+TBLFM in the line at point to the table." (interactive "P") (unless (org-at-TBLFM-p) (user-error "Not at a #+TBLFM line")) (let ((formula (buffer-substring @@ -3184,33 +3184,29 @@ with the prefix ARG." s e) (save-excursion ;; Insert a temporary formula at right after the table - (goto-char (org-TBLFM-begin)) + (goto-char (org-table-TBLFM-begin)) (setq s (set-marker (make-marker) (point))) (insert (concat formula "\n")) (setq e (set-marker (make-marker) (point))) - ;; Recalculate the table (beginning-of-line 0) ; move to the inserted line (skip-chars-backward " \r\n\t") (if (org-at-table-p) (unwind-protect (org-call-with-arg 'org-table-recalculate (or arg t)) - ;; delete the formula inserted temporarily (delete-region s e)))))) -(defun org-TBLFM-begin () +(defun org-table-TBLFM-begin () "Find the beginning of the TBLFM lines and return its position. Return nil when the beginning of TBLFM line was not found." (save-excursion (when (progn (forward-line 1) (re-search-backward - org-TBLFM-begin-regexp + org-table-TBLFM-begin-regexp nil t)) (point-at-bol 2)))) - - (defun org-table-expand-lhs-ranges (equations) "Expand list of formulas. If some of the RHS in the formulas are ranges or a row reference, expand diff --git a/lisp/org.el b/lisp/org.el index c0dc9d9af..3ea3cbd70 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -20240,7 +20240,9 @@ This command does many different things, depending on context: (and (eq type 'table-row) (= (point) (org-element-property :end context)))) (save-excursion - (if (org-at-TBLFM-p) (org-calc-current-TBLFM) + (if (org-at-TBLFM-p) + (progn (require 'org-table) + (org-table-calc-current-TBLFM)) (goto-char (org-element-property :contents-begin context)) (org-call-with-arg 'org-table-recalculate (or arg t)) (orgtbl-send-table 'maybe))) -- 2.11.4.GIT