浏览代码

org-table-fix-formulas: Ensure shifting columns after removing invalid

* lisp/org-table.el (org-table-fix-formulas): Search from the
beginning of table formula when shifting moved column numbers.

Reported-by: Uwe Brauer <oub@mat.ucm.es>
Link: https://orgmode.org/list/87r1gaw0av.fsf@mat.ucm.es
Ihor Radchenko 2 年之前
父节点
当前提交
ceb99b8600
共有 1 个文件被更改,包括 8 次插入7 次删除
  1. 8 7
      lisp/org-table.el

+ 8 - 7
lisp/org-table.el

@@ -2270,13 +2270,14 @@ For all numbers larger than LIMIT, shift them by DELTA."
 		 (format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove))))
 	    s n a)
 	(when remove
-          (while (re-search-forward re2 (line-end-position) t)
-	    (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
-	      (if (equal (char-before (match-beginning 0)) ?.)
-		  (user-error
-		   "Change makes TBLFM term %s invalid, use undo to recover"
-		   (match-string 0))
-		(replace-match "")))))
+          (save-excursion
+            (while (re-search-forward re2 (line-end-position) t)
+	      (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
+	        (if (equal (char-before (match-beginning 0)) ?.)
+		    (user-error
+		     "Change makes TBLFM term %s invalid, use undo to recover"
+		     (match-string 0))
+		  (replace-match ""))))))
         (while (re-search-forward re (line-end-position) t)
 	  (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
 	    (setq s (match-string 1) n (string-to-number s))