From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id YBqeI/j9TWVCKQEAG6o9tA:P1 (envelope-from ) for ; Fri, 10 Nov 2023 10:55:04 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id YBqeI/j9TWVCKQEAG6o9tA (envelope-from ) for ; Fri, 10 Nov 2023 10:55:04 +0100 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 3DAC25F678 for ; Fri, 10 Nov 2023 10:55:04 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cwqQN60A; dmarc=pass (policy=none) header.from=gmail.com; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1699610104; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=F7Sz71pPk3w9UhjTzxxY/2JDFc2WiXiH/Lk+IIGVErM=; b=lnKDkfRrCfEKc3ig/ZE2IhfgXL0z49fvmvhEjrottgrNzrKDZiSZvc2lkJ/SfS7kyy04K1 8TSiwWgg8SwfcyT7kUWAFJwONq1uvD4dZvMKPfw7tXwCAHwuCUNKY92PzXt23LZe2YuIbR D/BFEbxizueyAmhQQ5Q7VRgtvx1kIbpBGVd2ITVBbHS/Ogf2/YnjXfSKFtDz6ClWnhzZM4 zQaNReDT8ieVryZK9P1pc5tmbyQbz8sWL7E42206Z+F1ftxXGeEpkZWJSzwucKQ4FAImV6 ppDIk2IgqcwT+BCDNETzJ9AxhO9tG/rVpr6G7uzIKFdbkZ3dYecI7NlgukidDg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cwqQN60A; dmarc=pass (policy=none) header.from=gmail.com; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1699610104; a=rsa-sha256; cv=none; b=jYawhNwX6Yhnpn7gBrexyM1in+aMvhgYd3Oc/7tTuuQ6V+vNkt9uIDAztYwbgsJLb/4AXB /0tWAS61/fiEC35K5hQp1XwrxDRrKCWumrXXD7vKRtYlcvFk/x2oEo0nMg6Dr/ZVj3+6vE 0NEvlBkuA4J1tSDVxyO6KXJvsgjxE2VAzZgQjIYxGrQ2zd9mrNwZ2QXmDfr9proM3NulWM iT4AzWmAc5uJBzAsvo8Uj80ULqXl8PsO0VBLT+gbXzhl2mwGu9PFm05N5l138FoySFHbja kRhYQDrUKjqK0ATEupt4HkMTTaGjvF+1RcEZea0PXEDk/Qp3PAMb26kXeK4URw== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r1ODH-0003Nd-IY; Fri, 10 Nov 2023 04:54:07 -0500 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 1r1ODG-0003NF-Fi for emacs-orgmode@gnu.org; Fri, 10 Nov 2023 04:54:06 -0500 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r1ODE-0001fk-Mk for emacs-orgmode@gnu.org; Fri, 10 Nov 2023 04:54:06 -0500 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso1423203a12.3 for ; Fri, 10 Nov 2023 01:54:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699610042; x=1700214842; darn=gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=F7Sz71pPk3w9UhjTzxxY/2JDFc2WiXiH/Lk+IIGVErM=; b=cwqQN60Axgnm+L4nPdQvbMtFOxursRG2yIYGW7csItkhMacvd/An1lEpI534GPpoWh vKEoiAg1UrGbVQmTBadLivuvGDG7HXDcp7bsvnUS7TzbloVrifs2wGgsEr8cwNsglG9k rGVQhNDf1RaAcIFYA+58YzkfAy9qefJfofkJtnLJSRJeQ+W9dMxnamlGki9RJwnCWZ37 FIxIus6SOlQ2gUoIp0ATbgFMqjxvzXJL3YV4oGQxXqV6Og302PspLNYT2/KAGZUg73cU h+LD0EehXp3TcRHgV+i5SYXSe9+hJWvErLZUOL9Lyd+FphBR0U87OJiMxaTk9L7xoUj8 INtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699610042; x=1700214842; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F7Sz71pPk3w9UhjTzxxY/2JDFc2WiXiH/Lk+IIGVErM=; b=J3hHD7ihUucF9HcJny64dy5TOQqErE4zZ0Q0UMCI9ilWXKcQzwNp8TRlv+WDaPa5Xq NHKggQcxZwR3HQ50dKZdbTsqjTKsVKk3J75KJyilG90o2HU1CdVuxIh/CQA6o5FbDcqx GpvS4LOPS08EqjnZxik9hTEmy7cY6ikew/mCx3OGyT3lMpxp5EHqqhV6wX6XpHWEk3jW xxibEmNYNApKKf/1wdTGEbrWNPfUIUtM8csNxNjMq6KsLEJlLLyzAvx1tP/alJQ8ZFXR lS2eUfFNBR9Np5a23iUaFec8dh19Aqq7vRRnuornpeTwD6mPAwQeyNQ5t5z/6WGNwcbh SLDg== X-Gm-Message-State: AOJu0YxiEB05S43kaqwJq9cx6ZQIUIKE2XOJ94B+OG9zxlm1Gi/rv5Bd 5Whp3ULhdGKFIxH/qvr4WuSa1PMThrY= X-Google-Smtp-Source: AGHT+IG+AXL16AHQWvbVdI5EPnCKXC8vcTGI4OKlVxIe3ztB4YyWBL8qx3/J4jIKSHpsfJTuAXnKJQ== X-Received: by 2002:a05:6a21:19a:b0:181:10ee:20d5 with SMTP id le26-20020a056a21019a00b0018110ee20d5mr10273193pzb.12.1699610042210; Fri, 10 Nov 2023 01:54:02 -0800 (PST) Received: from hayvan (pharma2-70.w2k.pharmakol.uni-freiburg.de. [132.230.165.170]) by smtp.gmail.com with ESMTPSA id a2-20020a17090a480200b002804c91633dsm1207535pjh.14.2023.11.10.01.53.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Nov 2023 01:54:01 -0800 (PST) From: Mehmet Tekman To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [ANN] lisp/ob-tangle-sync.el In-Reply-To: <87fs1e0wue.fsf@localhost> References: <87o7k48jcf.fsf@localhost> <87v8e8m0ao.fsf@localhost> <87tttkghou.fsf@localhost> <87wmyc1sud.fsf@localhost> <87r0ok1qx4.fsf@localhost> <87o7jo1q2s.fsf@localhost> <87pm43kz3i.fsf@localhost> <87o7jlzxgn.fsf@localhost> <87fs1e0wue.fsf@localhost> Date: Fri, 10 Nov 2023 10:53:55 +0100 Message-ID: <87leb60w98.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=mtekman89@gmail.com; helo=mail-pg1-x533.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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-Spam-Score: -9.42 X-Spam-Score: -9.42 X-Migadu-Queue-Id: 3DAC25F678 X-Migadu-Scanner: mx10.migadu.com X-TUID: 4AucQLp6gpC1 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ihor Radchenko writes: > Mehmet Tekman writes: > >> Okay, I will definitely need to refactor my patches then, but I'm >> quite happy with the state of my current patch branch, so it will >> be an additional patch instead of a brand new set of patches >> I think. > > It has been a while since the most recent message in this thread. > May I know if you need any further help with the patch? > Hey, thanks for reaching out. No, I know what to do -- it's just finding the time to do it that is proving difficult. I made some small edits a few months ago, to reform the header arguments so that tangle actions would be encoded in the `:tangle-params' header and would largely leave the `:tangle' header alone=E2=80=A6 but when I test= ed it, it was failing all tests for reasons I wasn't to sure about. Here is the current state of my header-reform branch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-header-refs.patch Content-Description: header reform patch >From 9ba64d149aac6c807e233e34474ffe022488efe6 Mon Sep 17 00:00:00 2001 From: Mehmet Tekman Date: Wed, 20 Sep 2023 11:35:00 +0200 Subject: [PATCH] header refs --- lisp/ob-core.el | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index a7c4f2cab..0b0d1c18c 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -1753,6 +1753,42 @@ HEADER-ARGUMENTS is alist of all the arguments." header-arguments) (nreverse results))) + +(defun org-babel--split-str-quoted (str) + "Splits a string that may or may not contain quotes." + (let (result pos) + (while (string-match (rx (or (seq "\"" (group (* (not "\""))) "\"") + (group (+ (not space))))) + str pos) + (let ((match-str1 (match-string 1 str)) + (match-str2 (match-string 2 str))) + (if match-str1 + (progn + (push match-str1 result) + (setq pos (1+ (match-end 1)))) + (push match-str2 result) + (setq pos (match-end 2))))) + (nreverse result))) + +(defun org-babel--tangle-split (raw-tangle) + "Split a :tangle headerby filename and sync action." + (let* ((valid-sync-actions '("import" "export" "sync")) + (file-action (org-babel--split-str-quoted raw-tangle)) + (file (car file-action)) + (action (nth (1- (length file-action)) file-action))) + (if (member action valid-sync-actions) + ;; If last word matches, assume the previous are all part of + ;; the filename + (setq file (mapconcat #'identity (nreverse (cdr (nreverse file-action))) " ")) + ;; Otherwise set the default action and assume that the full + ;; string has no action + (if (or file action) + (setq action "export" + file (read-char raw-tangle)))) + (if (or file action) + (list file action) + (list nil)))) + (defun org-babel-process-params (params) "Expand variables in PARAMS and add summary parameters." (let* ((processed-vars (mapcar (lambda (el) @@ -1775,7 +1811,13 @@ HEADER-ARGUMENTS is alist of all the arguments." raw-result ;; FIXME: Arbitrary code evaluation. (eval raw-result t))) - (cdr (assq :result-params params)))))) + (cdr (assq :result-params params))))) + (raw-tangle (or (cdr (assq :tangle params)) "")) + (tangle-params (delete-dups + (append + (org-babel--tangle-split raw-tangle) + (cdr (assq :tangle-params params))))) + ) (append (mapcar (lambda (var) (cons :var var)) (car vars-and-names)) (list @@ -1786,7 +1828,9 @@ HEADER-ARGUMENTS is alist of all the arguments." (cons :result-params result-params) (cons :result-type (cond ((member "output" result-params) 'output) ((member "value" result-params) 'value) - (t 'value)))) + (t 'value))) + (cons :tangle-params tangle-params) + ) (cl-remove-if (lambda (x) (memq (car x) '(:colname-names :rowname-names :result-params :result-type :var))) -- 2.42.1 --=-=-= Content-Type: text/plain If you have any insight into why the tests are failing, I'd greatly appreciate it. Best, Mehmet --=-=-=--