On 19/07/2023 09:36, Gavin Downard wrote:
+++ b/lisp/org-table.el
@@ -2253,8 +2253,7 @@ LOCATION is a buffer position, consider the formulas
there."
((not (match-end 2)) m)
;; Is it a column reference?
((string-match-p "\\`\\$\\([0-9]+\\|[<>]+\\)\\'" m) m)
- ;; Since named columns are not possible in
- ;; LHS, assume this is a named field.
+ ;; This is either a named field or column.
(t (match-string 2 string)))))
(rhs (match-string 3 string)))
(push (cons lhs rhs) eq-alist)
Notice
"Double definition `%s=' in TBLFM line, please fix by hand"
below. A bit more code is required to keep this sanity check for named
columns.
@@ -2963,7 +2962,9 @@ existing formula for column %s"
(t old-lhs)))))
(if (string-match-p "\\`\\$[0-9]+\\'" lhs)
(push (cons lhs rhs) eqlcol)
- (push (cons lhs rhs) eqlfield))))
+ (if-let ((named-column (assoc lhs org-table-column-names)))
`if-let' is not available in Emacs-26
+ (push (cons (concat "$" (cdr named-column)) rhs) eqlcol)
+ (push (cons lhs rhs) eqlfield)))))
(setq eqlcol (nreverse eqlcol))
;; Expand ranges in lhs of formulas
(setq eqlfield (org-table-expand-lhs-ranges (nreverse eqlfield)))