From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id oEMDBf9Yy2T8fQAASxT56A (envelope-from ) for ; Thu, 03 Aug 2023 09:36:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id IHwEBf9Yy2RuEAAA9RJhRA (envelope-from ) for ; Thu, 03 Aug 2023 09:36:31 +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 5848162D38 for ; Thu, 3 Aug 2023 09:36:30 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=FPoIPYzB; 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=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1691048190; 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=mpyrNPk6wtLlVTNlnFAOIp1GpwJ0IljV5UgcjsQah/A=; b=lNwj3WYEVhOTNdM32P0e0Z45otorudkoRitMn+nLfA7aA4IWr8WmaNI2qIlMuHDqxMxYGg jhNsRzNomkv7rBShn+SX5JWPtlOAERop9HZfT8JIRc7w7xJYfeyexp1BU9JDF84pl6ZM7u uCcheo3fR4S0bmqvSi2mFnzNWJeUy/87tLUDuiEsR7w1asQQ4l98uswQWuey1AOte94s2o iCqHNJLDEfiFBdfSXs9UbI+FtUXcCv+f34Mq5z2ZTH7D01LA7EfaXvuD3UGsvGr+auSsay 5IVasldRnxWuaC7iq2EpPMiqiD47f3BX4IJ/l+/KQ4c5j4LTvoxau4QaXUOGVQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1691048190; a=rsa-sha256; cv=none; b=r1+IWivSo5jT+q6zYgQs+w6OOPgwWDG6M23R3bGMMLFqi82e9EprTMhzXw9nARfu8FQf7X vZDWrVbvdFUBup2GzxVX5aVpcy0M1+wBusrk9fmft46P1WJvwyTstfrCJKEgWizF3wyBkF Evfb/TGl+OykQBTX9NEhPchdHdYTaUBJrlLqQpmKiD6MiH9eM+4193ui+6eilvkkYBGI7C AvOpRcZnwWkrHT8n5ibpfAVsn6UhQTPXr74xa2yhV4/lD/dj2h7EXMkm+r+Ibfd4Jn1mu+ H2Hfus7ZWVesFgJuIw6Ie35UmvlqkrxTn0py+WtAGs7lglc1GPspvRqBId/kuw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=FPoIPYzB; 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=pass (policy=none) header.from=posteo.net Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qRSrj-0001Ea-Q6; Thu, 03 Aug 2023 03:35:23 -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 1qRSrh-00019v-Iy for emacs-orgmode@gnu.org; Thu, 03 Aug 2023 03:35:21 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qRSrc-0000vz-H4 for emacs-orgmode@gnu.org; Thu, 03 Aug 2023 03:35:19 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id ED838240029 for ; Thu, 3 Aug 2023 09:35:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1691048112; bh=F00UztW+ayvgG4HZYnz+cGKw0qa5gG2hgjOHlxo3mXs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=FPoIPYzB/t0sKDgbexOvd9vJW9gFN3aCVrpoEwQzcDSOcVMr15fBP59O+juGHy6gU lk0OqibUsd7I3+Nek4NztrW0ph7bcD9jdkm5Iokau0348nkEmdN0AkAwj17vhHS04T zSTHyvFSIThU06x2oW3Yvgy207i3hxrQ90fo0kgNO3MF3f1NAH3px5KTPg5wumm+or ewcBsEiOfhIR+iqQzGAnDPaGAdGXOFOR536amO3Z/cYi/XZmGqOw8CX90m+11kJO2R r3egHmHYHjLCiUf5CDLK7rjF4d4ALyBlrQhANv3Q1L+hFy+w0GlyYvIlaL4sTUse6H LDyUmQSIujRUg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RGgbz21Nkz6twH; Thu, 3 Aug 2023 09:35:11 +0200 (CEST) From: Ihor Radchenko To: Mehmet Tekman Cc: emacs-orgmode@gnu.org Subject: Re: [ANN] lisp/ob-tangle-sync.el In-Reply-To: References: <87sfc4a0ce.fsf@localhost> <87r0ro9mzc.fsf@gmail.com> <87zg69zq49.fsf@localhost> <87r0rg1lwe.fsf@gmail.com> <87leho3y0n.fsf@localhost> <87a5y3vzpe.fsf@gmail.com> <87jzx6ylrm.fsf@localhost> <87ttw8kd9u.fsf@gmail.com> <87fs5ppcx7.fsf@localhost> <875y6hwqqe.fsf@localhost> <87o7k48jcf.fsf@localhost> <87v8e8m0ao.fsf@localhost> <87tttkghou.fsf@localhost> Date: Thu, 03 Aug 2023 07:35:22 +0000 Message-ID: <87wmyc1sud.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-Queue-Id: 5848162D38 X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -7.57 X-Spam-Score: -7.57 X-TUID: RFDzNj2Xh7W9 Mehmet Tekman writes: > It's a big patch mostly, because there were no intermediate commits > in which the org framework wouldn't be broken. Hope that's okay! Sure it is. > ** Problems > > It seems to work well for most tests, except for the "file with > spaces.txt" which I'm not sure how to proceed with. I feel like > patching at the level `org-babel--merge-params' is the wrong way to > go, and that I should patch it further upstream. > > That upstream leads to `org-babel-read' which currently chomps the > quotes off anything it gets: > > #+begin_src elisp > (org-babel-read " \"my file with quotes\" ") > #+end_src > I don't know if this is the expected behaviour for quoted strings with > spaces, so before I proceed trying to patch this I thought I would > check in with you and ask whether I should start patching here or not. This is indeed a problem. Org cannot distinguish between #+begin_src lang :foo value with spaces and #+begin_src lang :foo "value with spaces" What we can do it make `org-babel-read' assign a text property to the resulting string when it is a string with quotes: (org-babel-read "my file with quotes") ; => "my file with quotes" (org-babel-read "\"my file with quotes\"") ; => #("my file with quotes" 0 19 (org-babel-quote t)) Then, we can later use this information in `org-babel-merge-params'. We will not call `split-string', when 'org-babel-quote text property is present. Also, `split-string' won't work when we have something like "yes \"my file with quotes\"" Instead, we should use (mapcar #'org-babel-read (org-babel-balanced-split "yes \"my file with quotes\"" ?\s)) > - (tangle . ((tangle yes no :any))) > + (tangle . ((tangle yes no :any) > + (import export skip sync))) We should not yet change this before the code using the new tangle values is in place. > +(defun org-babel--merge-headers (exclusive-groups &rest result-params) > + "Maintain exclusivity of mutually exclusive parameters, as defined > +in EXCLUSIVE-GROUPS while merging lists in RESULT-PARAMS." Please update the docstring, following conventions: 1. First line should be a short full sentence explaining what function does briefly. 2. Each argument should be explained - what it is and what is the structure. Also, RESULT-PARAMS is confusing because it is no longer just used for :results. Please rename. > + (cl-flet ((alist-append (alist key val) > + (let ((existing (cdr (assoc key alist)))) > + (if existing > + (setcdr (assoc key alist) (append existing (list val))) > + (setq alist (cons (cons key (list val)) alist))) > + alist))) Can simply (push val (alist-get key alist nil nil #'equal)) > + ;; Problem: Having an :any keyword in an exclusion group means > + ;; that a parameter of "yes" could match to an exclusion > + ;; group that contains both "yes" AND ":any". > + ;; Solution: For each parameter, build a list of exclusion groups > + ;; it could belong to. If a parameter belongs to two > + ;; groups, eliminate it from the group that contains the > + ;; ":any" keyword. > + ;; > + ;; Details: Exclusion groups (e.g.'("tangle" "yes" "no" ":any") ) > + ;; are referenced to by their car ("tangle"), acting as > + ;; a key for the entire group. > + ;; This is not a "problem" - just something to consider. You can omit "Problem:", "Solution:", and "Details:" converting into ordinary paragraphs. > + ;; Assumption: The order of RESULT-PARAMS dictate the hierarchy of > + ;; the cascading headers. The expected function parameters should be described in the docstring, not in a comment. > + (let ((any-group-key ;; exclusion group key for group with :any keyword > + (caar (cl-remove-if-not (lambda (x) (member ":any" x)) exclusive-groups))) `cl-find' will be simpler. > + (delete-dups unexplained-params) Should be (setq unexplained-params (delete-dups unexplained-params)) `delete-dups' _returns_ the modified list, which may or may not preserve the initial pointer to the first cons cell. > + ;; Set values in the same order that the exclusion groups are defined > + (let ((group-key-order (mapcar #'car exclusive-groups))) > + (setq group-alist (cl-remove-if-not #'identity Or just delq nil > + (mapcar (lambda (x) (car (alist-get x group-alist))) > + group-key-order)))) -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at