6996 |
(t n)))) |
(t n)))) |
6997 |
|
|
6998 |
(defun org-table-get-vertical-vector (desc &optional tbeg col) |
(defun org-table-get-vertical-vector (desc &optional tbeg col) |
6999 |
"Get a calc vector from a column, accorting to desctiptor |
"Get a calc vector from a column, according to descriptor DESC. |
7000 |
Optional arguments TBEG and COL can give the beginning of the table and |
Optional arguments TBEG and COL can give the beginning of the table |
7001 |
the current column, to avoid unnecessary parsing." |
and the current column, to avoid unnecessary parsing." |
7002 |
(save-excursion |
(save-excursion |
7003 |
(or tbeg (setq tbeg (org-table-begin))) |
(or tbeg (setq tbeg (org-table-begin))) |
7004 |
(or col (setq col (org-table-current-column))) |
(or col (setq col (org-table-current-column))) |
7046 |
l ",") "]")) |
l ",") "]")) |
7047 |
((string-match "\\([0-9]+\\)" desc) |
((string-match "\\([0-9]+\\)" desc) |
7048 |
(beginning-of-line 1) |
(beginning-of-line 1) |
7049 |
(when (re-search-backward org-table-dataline-regexp tbeg t |
(when (re-search-backward org-table-dataline-regexp tbeg t |
7050 |
(string-to-number (match-string 0 desc))) |
(string-to-number (match-string 0 desc))) |
7051 |
(org-table-goto-column col) |
(org-table-goto-column col) |
7052 |
(org-trim (org-table-get-field)))))))) |
(org-trim (org-table-get-field)))))))) |
7142 |
ACTION can be `remove', `insert', `swap'. For `swap', two column numbers are |
ACTION can be `remove', `insert', `swap'. For `swap', two column numbers are |
7143 |
expected, for the other action only a single column number is needed." |
expected, for the other action only a single column number is needed." |
7144 |
(let ((list (org-table-get-stored-formulas)) |
(let ((list (org-table-get-stored-formulas)) |
7145 |
(nmax (length (org-split-string |
(nmax (length (org-split-string |
7146 |
(buffer-substring (point-at-bol) (point-at-eol)) |
(buffer-substring (point-at-bol) (point-at-eol)) |
7147 |
"|"))) |
"|"))) |
7148 |
col col1 col2 scol si sc1 sc2) |
col col1 col2 scol si sc1 sc2) |
7221 |
fields (org-split-string (match-string 2) " *| *")) |
fields (org-split-string (match-string 2) " *| *")) |
7222 |
(save-excursion |
(save-excursion |
7223 |
(beginning-of-line (if (equal c "_") 2 0)) |
(beginning-of-line (if (equal c "_") 2 0)) |
7224 |
(setq line (org-current-line) col 1) |
(setq line (org-current-line) col 1) |
7225 |
(and (looking-at "^[ \t]*|[^|]*\\(|.*\\)") |
(and (looking-at "^[ \t]*|[^|]*\\(|.*\\)") |
7226 |
(setq fields1 (org-split-string (match-string 1) " *| *")))) |
(setq fields1 (org-split-string (match-string 1) " *| *")))) |
7227 |
(while (and fields1 (setq field (pop fields))) |
(while (and fields1 (setq field (pop fields))) |
7557 |
(goto-line thisline) |
(goto-line thisline) |
7558 |
(org-table-goto-column thiscol) |
(org-table-goto-column thiscol) |
7559 |
(or noalign (and org-table-may-need-update (org-table-align)) |
(or noalign (and org-table-may-need-update (org-table-align)) |
7560 |
(and all (message "Re-applying formulas...done" cnt))))) |
(and all (message "Re-applying formulas...done"))))) |
7561 |
|
|
7562 |
(defun org-table-formula-substitute-names (f) |
(defun org-table-formula-substitute-names (f) |
7563 |
"Replace $const with values in stirng F." |
"Replace $const with values in string F." |
7564 |
(let ((start 0) a n1 n2 nn1 nn2 s (f1 f)) |
(let ((start 0) a n1 n2 nn1 nn2 s (f1 f)) |
7565 |
;; First, check for column names |
;; First, check for column names |
7566 |
(while (setq start (string-match org-table-column-name-regexp f start)) |
(while (setq start (string-match org-table-column-name-regexp f start)) |
7621 |
(set (make-local-variable 'org-pos) pos) |
(set (make-local-variable 'org-pos) pos) |
7622 |
(set (make-local-variable 'org-window-configuration) wc) |
(set (make-local-variable 'org-window-configuration) wc) |
7623 |
(use-local-map org-edit-formulas-map) |
(use-local-map org-edit-formulas-map) |
7624 |
(setq s "# Edit formulas and finish with `C-c C-c'. |
(setq s "# Edit formulas and finish with `C-c C-c'. |
7625 |
# Use `C-u C-c C-c' to also appy them immediately to the entire table. |
# Use `C-u C-c C-c' to also appy them immediately to the entire table. |
7626 |
# Use `C-c ?' to get information about $name at point. |
# Use `C-c ?' to get information about $name at point. |
7627 |
# To cancel editing, press `C-c C-q'.\n") |
# To cancel editing, press `C-c C-q'.\n") |
7659 |
(switch-to-buffer-other-window (marker-buffer pos)) |
(switch-to-buffer-other-window (marker-buffer pos)) |
7660 |
(goto-char pos) |
(goto-char pos) |
7661 |
(goto-char (org-table-begin)) |
(goto-char (org-table-begin)) |
7662 |
(if (re-search-forward (concat "^[ \t]*| *! *.*?| *\\(" var "\\) *|") |
(if (re-search-forward (concat "^[ \t]*| *! *.*?| *\\(" var "\\) *|") |
7663 |
(org-table-end) t) |
(org-table-end) t) |
7664 |
(progn |
(progn |
7665 |
(goto-char (match-beginning 1)) |
(goto-char (match-beginning 1)) |
7714 |
(org-table-store-formulas eql) |
(org-table-store-formulas eql) |
7715 |
(move-marker pos nil) |
(move-marker pos nil) |
7716 |
(kill-buffer "*Edit Formulas*") |
(kill-buffer "*Edit Formulas*") |
7717 |
(if arg |
(if arg |
7718 |
(org-table-recalculate 'all) |
(org-table-recalculate 'all) |
7719 |
(message "New formulas installed - press C-u C-c C-c to apply.")))) |
(message "New formulas installed - press C-u C-c C-c to apply.")))) |
7720 |
|
|