From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id oKlzLnNIUmSMrwAASxT56A (envelope-from ) for ; Wed, 03 May 2023 13:41:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 4ClPLnNIUmT8XwEA9RJhRA (envelope-from ) for ; Wed, 03 May 2023 13:41:39 +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 417C71292B for ; Wed, 3 May 2023 13:41:39 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puAqp-0007dA-7i; Wed, 03 May 2023 07:40:51 -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 1puAqm-0007Xo-4C for emacs-orgmode@gnu.org; Wed, 03 May 2023 07:40:48 -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 1puAqj-0002a8-2N for emacs-orgmode@gnu.org; Wed, 03 May 2023 07:40:47 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 2CC05240027 for ; Wed, 3 May 2023 13:40:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1683114041; bh=5Mh533nXr7aJmBtUQPvZXYr5ReNFw2UcYLf2Jj2c8fg=; h=From:To:Cc:Subject:Date:From; b=m7ZR8Gkfc2MC5fgMX/lDICBG32VevX0bv40C0UBLW17kd5Ue9Gwr0szbh6DgylkIa XkPr8Y8CTZC9piylu1QTuH6ytfKPNnA5wh54sPSiO1FrpuAZiSI6HTFAY27ivzl0UZ 96WeGVKpqtyQgN5KjsPXN7nFmFPchuF65L7Rtm5f4M86UUpigOP67dEEs999xb49e8 4oNhQF9+oSinA0MhFgB92m/55ACJp8FWzOxksgR2VB2uD7Y8WIJpvjKq6a6bJmd9lt Y68kZGFaFyqDcezlcPNi86D4nUd1z0pJui28NVaGSPA3NpgPSa/mW/9/fG4t2MR6Bt 9uXbwEsXul10Q== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QBFPh5LMHz9rxN; Wed, 3 May 2023 13:40:40 +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: Date: Wed, 03 May 2023 11:43:51 +0000 Message-ID: <87r0rxabd4.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_H2=-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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683114099; a=rsa-sha256; cv=none; b=X/4MZlM5QGlZ5UQcAhnFJ0v77NNFyxU4xKc0GgXi82sIGmIvTicirnCe/P4Mwq4Rob0VRI lVYBXsQqapP9tNPAJtTtJ6ULzB3fFtBoD7wkvcY5auvPGSZMoVXVAksnc0pxYUCkFiRph3 EgzarUBbXNh+/UXph9DEQWlyVKvhiWlwJJSM2OoZe8SzgKa33AucnTrZYkN3MnqcGhpDk3 7ynwp6ZnD1r33xS5+ve0N0EQM+qq1YppTebjTcqN+PD3nLFo2ArghrWM+RshCu4F7KLuEu j5eDkEAmJixZhzmP/yNYRMvLANHQgsmok+e8gt9qy1V1d0GUaVqLUqt7wePgTQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=m7ZR8Gkf; dmarc=pass (policy=none) header.from=posteo.net; 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=1683114099; 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=c0G7gRVsCJurEXrvWiCgbqJJrD7feWTokBHhU3fcusE=; b=iyLnDT2PdKwnysHHzRXMohqb1KizLzrBzmojXHBbegEwxPOoSxODvroaMYIUNCWwLI6W++ fmCmP9GDxEZbFbWST4iQ8HJwT6hHFJNwvJh3YTEJB2LvU5mrOcppO+FjF3cSV85xs3mbzU 1lvCw28fEr0SX9HYe6ME64UrdJgm4rZYOqECA8RoFqvEsDGPRgRYg/RqyGeczN1CTie/7l 3jMSjYdAeLhhiTKWWJyLgLRSWpYEPsBpxqfXYQAIbOyRAGRxn131jB6V2XT/7lNRZm57Sf hxcZi4pWqYJjQTE4aRWvM7hIi5rv494Y1+Lp0310zqYY8D5UDLXaHNWlozkg1w== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=m7ZR8Gkf; dmarc=pass (policy=none) header.from=posteo.net; 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" X-Migadu-Spam-Score: -6.19 X-Spam-Score: -6.19 X-Migadu-Queue-Id: 417C71292B X-TUID: NP1q/c/phgjy Mehmet Tekman writes: > I've modified the ob-tangle.el file for the main tangling and > detangling functions. Most importantly, both functions can now > exchange information from the source Org mode file to the target > remote tangle file in either direction, depending on whether the > source Org file has `:tangle-sync ' in the header. Thanks! > The action is one of: > > - "export" = always transmit information from the source Org mode > block to the target remote file. > - "import" = always transmit information from the target remote > file to the source Org mode block. > - "skip" = skip the block. > - "both" = transmit information from source block to target block > or target block to source, depending on whether the > tangle or detangle is called from the source buffer or > the target buffer respectively. May it be better to make :tangle header argument compound? Like ":tangle "file" export". Similar to :results header argument. See "16.6 Results of Evaluation" section of Org manual. Also, some general comments on the patches: 1. Please make sure that patches do not leave Org in broken state in the middle of the patchset. Your patch #1 adds two `defun's in the middle of `org-babel-detangle', which is not right. 2. When naming private functions, "--" should be after library prefix: org-babel--... 3. Please do not use private functions from third-party libraries. I am talking about `cl--set-buffer-substring' in particular. 4. Please make sure that docstrings clearly describe what the function does, each of its arguments, and the expected return value. In the patch, `org-babel-detangle--block-contents', NEAREST is ambiguous. The actual meaning is "block at point or previous block". 5. Pay attention to buffer boundaries. In particular, remember that buffer may be narrowed when you call a command and that expressions like (+ 2 (line-beginning-position)) may resolve beyond `point-min'/`point-max'. 6. Avoid using cryptic list functions like `cdadar' when you can use something more readable. 7. When naming functions or macros, make sure that the name is roughly describing the purpose of the function. In `org-babel-detangle', you added `single-block-metrics' local function that does not only do the metrics, but also (unexpectedly!) calls `org-babel-detangle-single-block'. This is especially important for local functions that lack docstring. 8. In `org-babel-tangle', (setq block-counter (+ 1 block-counter)) appears to be misplaced into outer sexp level after your patch. 9. In commit messages, please mark newly added functions clearly. Like "(org-babel-foo): New function. It does this and that." Same for commit summaries - "lisp/ob-tangle.el: Detangle a single block" is awkward. You should clearly indicate that you added something new to the library. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at