]> code.delx.au - gnu-emacs/blobdiff - lisp/org/org-table.el
Update copyright year to 2015
[gnu-emacs] / lisp / org / org-table.el
index c9522341106540ff29bb066469b0eabe8673e96d..d84c51bbbc3970b434da227156b214daed8d20e5 100644 (file)
@@ -1,6 +1,6 @@
 ;;; org-table.el --- The table editor for Org-mode
 
-;; Copyright (C) 2004-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2015 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -2351,7 +2351,7 @@ For all numbers larger than LIMIT, shift them by DELTA."
                     (string-match "^[a-zA-Z][_a-zA-Z0-9]*$" field))
            (push (cons field v) org-table-local-parameters)
            (push (list field line col) org-table-named-field-locations))))
-      ;; Analyse the line types
+      ;; Analyze the line types.
       (goto-char beg)
       (setq org-table-current-begin-line (org-current-line)
            org-table-current-begin-pos (point)
@@ -2712,7 +2712,8 @@ not overwrite the stored one."
          (or (fboundp 'calc-eval)
              (user-error "Calc does not seem to be installed, and is needed to evaluate the formula"))
          ;; Use <...> time-stamps so that Calc can handle them
-         (setq form (replace-regexp-in-string org-ts-regexp3 "<\\1>" form))
+         (while (string-match (concat "\\[" org-ts-regexp1 "\\]") form)
+           (setq form (replace-match "<\\1>" nil nil form)))
          ;; I18n-ize local time-stamps by setting (system-time-locale "C")
          (when (string-match org-ts-regexp2 form)
            (let* ((ts (match-string 0 form))
@@ -3182,9 +3183,9 @@ with the prefix ARG."
     (save-excursion
       ;; Insert a temporary formula at right after the table
       (goto-char (org-table-TBLFM-begin))
-      (setq s (set-marker (make-marker) (point)))
+      (setq s (point-marker))
       (insert (concat formula "\n"))
-      (setq e (set-marker (make-marker) (point)))
+      (setq e (point-marker))
       ;; Recalculate the table
       (beginning-of-line 0)            ; move to the inserted line
       (skip-chars-backward " \r\n\t")
@@ -3862,9 +3863,10 @@ With prefix ARG, apply the new formulas to the table."
        (push org-table-current-begin-pos org-show-positions)
        (let ((min (apply 'min org-show-positions))
              (max (apply 'max org-show-positions)))
-         (goto-char min) (recenter 0)
+         (set-window-start (selected-window) min)
          (goto-char max)
-         (or (pos-visible-in-window-p max) (recenter -1))))
+         (or (pos-visible-in-window-p max)
+             (set-window-start (selected-window) max))))
       (select-window win))))
 
 (defun org-table-force-dataline ()