From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id kPC6LZnPu2TLdAAASxT56A (envelope-from ) for ; Sat, 22 Jul 2023 14:46:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id gD9ULZnPu2TJJwEAauVa8A (envelope-from ) for ; Sat, 22 Jul 2023 14:46:17 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 59B674100E for ; Sat, 22 Jul 2023 14:46:17 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=f9pjIFPu; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1690029977; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=FFZeIWiWgHckMR3t+3V/sOuO4oZc7JltTI6LYtlXw0U=; b=iPaSoXy811aGYfIRK0z9LpPKzy8ZMpFsKPdytbZtkMgntMfq5G07Y3LCTsjEquSB5dIgGH X7FjNZOwrSFNfnqcChT0A721iAa49AcgRs1VcGKQ0LUBPZqrL86S4Cp2TV3lTPiLDxNkja bkfqwmbctAyGDawP+EH1dyz8oj6c4j7rQ62wdNibk2G+p2BX4I/rROS47JKHLPmPYQJ7F9 /cGI4HdG9OGFuj6nxr4YubhenESP4ONlc5NvBrE52Hc/CLYNqmVyKgG7Tv2MKuHRxeyHpj hQPiw2X+XnIzc0IPX+hHkbP2lZlMQ4tjC/YL+XcaN1GzpUNI1m8g/acVkKdMkg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1690029977; a=rsa-sha256; cv=none; b=WDMOLhuSyHoHl5LTZpckm0YK0yZvqmpBs5g53bGek/fTOKGuyZ+T8q2y3eJjp8Ioac48k6 8Q3+c77Mqjcek0MJBki3T9YN8VRZZtcHq6bxzaX4NVOlQygCavO4wARWIP92nqORffPAQo yPZE8D0BE/R/WuBBpvOGBzrsJj/iOF2AMVxMszU+bTfsyFJVakVZNE3Y0J+yHZbvYzrvTR QB/NYxz0PJvWUC0pFW3rwJvJEj9VOAHx53RZ06eHJfciVn/uzRLJEQhlpkKNYDDMKH6KkY X/BG70DiRtMDu19uNoevxQjyS2PbxnEdybFLTzTaBedLpYFowydP1Wj5MuODPg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=f9pjIFPu; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNBz8-0003Bo-Io; Sat, 22 Jul 2023 08:45:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNBz5-0003BN-VH for emacs-orgmode@gnu.org; Sat, 22 Jul 2023 08:45:19 -0400 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qNBz4-0006Js-9i for emacs-orgmode@gnu.org; Sat, 22 Jul 2023 08:45:19 -0400 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2b74209fb60so41439561fa.0 for ; Sat, 22 Jul 2023 05:45:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690029916; x=1690634716; h=content-transfer-encoding:in-reply-to:mail-followup-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=FFZeIWiWgHckMR3t+3V/sOuO4oZc7JltTI6LYtlXw0U=; b=f9pjIFPuSnTcA6tyxKjPODghwjLfiVUqvLPFmgY99O6i0lddVr7d5WdL+yBTXYtOM0 Moc7dS/GqCqzxdrjkpbBwzTSTclHzhUKHEtFekAFETngtp4mWY9NGAN+GbnYxxT/IvWL EWXoiYLBkA89vcHJ+OvjAZDmTWOTUed14fVLU8VlF7t/8FC92xB1ntRhIQiZmYdwe0Mq f3z5UeURqdHtr8EOdqftxSj+nbVcxltLmhJmlMqYb/N/JVtqpHtzlq+M8zxf3S1PlsdJ MNIFxoiZjm4P2i6SjDfQUa85vcLr2qMh40UUN8wZF1FCSe4452XGuzQd/XFtT5uvEKma L+Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690029916; x=1690634716; h=content-transfer-encoding:in-reply-to:mail-followup-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FFZeIWiWgHckMR3t+3V/sOuO4oZc7JltTI6LYtlXw0U=; b=Rarm0YOZ94/xUwWLAl/EAuFirlxy3R3Jzzo9wrHyKHNEM9g2uzDL/fKGEXk85FjTxY HQFkTRZlPQIP3Kk6Q+WEW1CuTe7FYufYIppPleIBjc1CYs6i9fTS1xWDNcfSIz66T8w2 CJRNqsMCJ/w+Tty6SgZR6BEPMyZnz1Ke1RlxNAzsjsvqRDiNv72iJwoxYcqO2AtrYGlU BLJbzY61D+4Uv0jEL2ZtFAGDFdlWhfzFC5VtF105sAawxzYgnIz363A5pVNo0/xgKD6d XFi//lBx+9UTWwx+/H2UcHK/Wj/oocIkiRunNo7yhVRoH1TYJYGyMSwB8YzXd0InHN3c w8bw== X-Gm-Message-State: ABy/qLZGcTOjLA3VnRr/O9aBx958hQYzO3VsLOAj+Dwq5EN1+BcNGnpy TiNW1JPSJ3oFzlI4jyXDU8o= X-Google-Smtp-Source: APBJJlFDClI0nXchRH5fFsnks+c26YdAJMMKzgmzcaXY31fK7mFaZXtwp3jHeeL6qxTSk9EZzHaStA== X-Received: by 2002:a2e:9b17:0:b0:2b6:dec9:2812 with SMTP id u23-20020a2e9b17000000b002b6dec92812mr3071629lji.33.1690029915924; Sat, 22 Jul 2023 05:45:15 -0700 (PDT) Received: from [192.168.0.101] (nat-0-0.nsk.sibset.net. [5.44.169.188]) by smtp.googlemail.com with ESMTPSA id u9-20020a2e9b09000000b002b6cb598558sm1553438lji.49.2023.07.22.05.45.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 22 Jul 2023 05:45:15 -0700 (PDT) Message-ID: Date: Sat, 22 Jul 2023 19:45:14 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] lisp/org-table.el: Allow named columns on lhs Content-Language: en-US, ru-RU To: Gavin Downard , emacs-orgmode@gnu.org References: <877cqwbpa2.fsf@runbox.com> From: Max Nikulin Mail-Followup-To: Gavin Downard , emacs-orgmode@gnu.org In-Reply-To: <877cqwbpa2.fsf@runbox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=manikulin@gmail.com; helo=mail-lj1-x233.google.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.091, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx2.migadu.com X-Migadu-Spam-Score: 4.17 X-Spam-Score: 4.17 X-Migadu-Queue-Id: 59B674100E X-TUID: GHkXRzDplWoa 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)))