From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id EOMIMSC65GJaMQAAbAwnHQ (envelope-from ) for ; Sat, 30 Jul 2022 06:57:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id SMTbMCC65GIpAwAAauVa8A (envelope-from ) for ; Sat, 30 Jul 2022 06:57:04 +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 55993F225 for ; Sat, 30 Jul 2022 06:57:04 +0200 (CEST) Received: from localhost ([::1]:46436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHeX8-00020o-Q8 for larch@yhetil.org; Sat, 30 Jul 2022 00:57:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHeW2-00020f-SO for emacs-orgmode@gnu.org; Sat, 30 Jul 2022 00:55:54 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:46894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oHeVs-0007kp-KV; Sat, 30 Jul 2022 00:55:54 -0400 Received: by mail-pf1-x42e.google.com with SMTP id c3so6196003pfb.13; Fri, 29 Jul 2022 21:55:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=sTx26zVc5d/rhFslezyF74bjKffL5UxawkKAy9QGpFo=; b=Ijtx0tAJ9R6h0/F7gdvmZtOKcR4GuISH/tCiEVYMhTLHAsOpW7bZaFRF26A+x/05Wm kaIgNV+IAzT8JtFgP8g/C4Ti9Di6fZdxAp9qQ9IjGNC5JuqLi+yAOhuRNhcXwkzG6yrS CgORSuYPWw6o125hIMl3MFw6CmLbRRcHFX8PciMtR77I+Nk1RnBE7Wx1VSb9L9afUgTe UuaP83a4voSWbR09jjJP8v6LejPPBc7hByxgbCuupxBE1/mroiHZyZxQCOn7TqFkLitx YJW22HLXvfeYUeqgMMtCFAzr6RjIMB8GEHuL4NU1RyX0ADJ3ErFvsy/VYZOXs75bA4fy 6SFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=sTx26zVc5d/rhFslezyF74bjKffL5UxawkKAy9QGpFo=; b=cVDC0IVI+kLHVejG9m6EG0iMzThtdKNErHiB69GyxZ7s/OseUHClihjxXGaQ9zGi4a R6XMH490Cn560obHZIqKEtjVr4T9LiMlhOC4/nOAN+NHShNxZGUaQ/3+mBCoe+Sc2E19 DfulKv6h//ImV93dqdrlMJ5o0Xn/Fu7nt72nuiK3LlIk6NnpHNa3dflrgAhlelp7N0X7 qzsnYeTtMqbeAvr0YSHGdWy2wLToL9D9RzZy1JMTuffSSCT1Sal3O1ShwbpT+cPE1vOQ 6s8iLTEpYzwSwr2S39nQ09ABUqulNPmngBKD+aRJsvcM8i8w11CUGQ3NNuI/RGBLBbJP dNXg== X-Gm-Message-State: AJIora/RofKT8s0ysKdV2FKW3+ATn7kefJhO88/ONDC5jwgJlH/uD4wK z01iWXih+sfknzGrxJh7Y7I= X-Google-Smtp-Source: AGRyM1vpqfUHbKpOMDtzP4v576s9N/gA710i2x4+/Gt0YuORYx5FHvLKLIJy2bjFaBWqvQs1w9UNFw== X-Received: by 2002:a63:5d45:0:b0:419:ab8f:c022 with SMTP id o5-20020a635d45000000b00419ab8fc022mr5264375pgm.557.1659156940682; Fri, 29 Jul 2022 21:55:40 -0700 (PDT) Received: from localhost ([1.83.155.1]) by smtp.gmail.com with ESMTPSA id u132-20020a62798a000000b00527bb6fff6csm3779023pfc.119.2022.07.29.21.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jul 2022 21:55:39 -0700 (PDT) From: Ihor Radchenko To: Hraban Luyat , Bastien Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] ob-tangle.el: fix =?utf-8?Q?=E2=80=98=3Acomments_nowe?= =?utf-8?Q?b=E2=80=99?= double linking In-Reply-To: <01070182484e44f3-f0fd271a-def3-4c86-961f-9a4bb63949d5-000000@eu-central-1.amazonses.com> References: <01070182484e44f3-f0fd271a-def3-4c86-961f-9a4bb63949d5-000000@eu-central-1.amazonses.com> Date: Sat, 30 Jul 2022 12:56:42 +0800 Message-ID: <87wnbvtcz9.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=yantar92@gmail.com; helo=mail-pf1-x42e.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, 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659157024; 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: 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=sTx26zVc5d/rhFslezyF74bjKffL5UxawkKAy9QGpFo=; b=AJPKdBVWJiMTTBFJAA1B0WDXA5JTTDO2VzMvKpfCqZAjT0FGPCW8ThlNO3eSv6xu3rnbET pQbSmtorqik0b0JQBRqr+zZaMAQRqWwqEtW7zk19FHD6XVUC9XfGlEqLCQUNINpINLs/vW c37pLv+mHERBU6EZMszEa5aUovgd4+8cCdvf6xa8WzD0jYnF6vSaAESXEOuYe37cQg79Kz WhOuQlpR9jXpTOpFSxFcGmyaGCGRnlUG7HujEpI0NzFPS7xFXwUDon1N6EW34ajmKduPlX 4E56Ju8AfpHr5MbbdJwzXpuWqanwvvPE1PtraUKtD14cYpOYsjma9SJqSL84Rw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659157024; a=rsa-sha256; cv=none; b=ZDZInBoNXcvt5UchEV1fJ7JPg1I2X42rOd+p/PMiJ1z4mmZ6bl9m3DectZbL44KBQEmOAo scwGJhf4EDhVyn/v/3wOYfGlf89lE20mE1Or9Hvrky3Fx2IGWLFcRJsvSBDyNvT8yqJe3M WKUjEHKFPM72VPSFOhW+O4s4NSzW3qf1Nv0jzIT+qFd0QuRsXZI1dNuWy0lgugBgUS+oKz cUL+R8DwBYPn5Kg1mByxyYoOfjtWvM96o/l4S17brDTCAcmnyfuQBgBe+iLuKpmCokjcy7 loKkOwIBG2UFpnTV1wGeJBXebkjEKdWOe2WIfTrjfdznvfSYXZnyrSKLqz3J0g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Ijtx0tAJ; 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" X-Migadu-Spam-Score: -9.23 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Ijtx0tAJ; 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" X-Migadu-Queue-Id: 55993F225 X-Spam-Score: -9.23 X-Migadu-Scanner: scn0.migadu.com X-TUID: k6qb154Hh98U Hraban Luyat writes: > This is my first org-mode patch, all comments welcome :). I signed a > copyright assignment to the FSF 2021-07-12. Thanks for the contribution! Bastien, could you please check the FSF records? The patch looks good in general. Few minor comments below. > * lisp/ob-tangle.el: Refactor the double implementation to a single > helper function. This avoids the double link wrapping. > * testing/lisp/test-ob-tangle.el: Add unit tests. > > Babel tangle allows inserting comments at the tangled site which link > back to the source in the org file. This linking was implemented > twice, to handle separate cases, but when using =E2=80=98:comments noweb= =E2=80=99 it > ended up going through both codepaths. This resulted in doubly wrapped > links. Please use double space " " between sentences. See https://orgmode.org/worg/org-contribute.html#commit-messages > +(defun org-babel-tangle--unbracketed-link (params) > + "Get a raw link to the src block at point, without brackets. > + > +The PARAMS are the 3rd element of the info for the same src block. > +" No newline at the end of the docstring, please. See D.6 Tips for Documentation Strings in Elisp manual: =E2=80=A2 Do not start or end a documentation string with whitespace. > + (let* (;; The created link is transient. Using ID is not necessary, > + ;; but could have side-effects if used. An ID property may > + ;; be added to existing entries thus creatin unexpected file > + ;; modifications. Can as well fix the "creatin" typo here. > + (org-id-link-to-org-use-id nil) > + (l (org-no-properties (org-store-link nil))) > + (bare (and (string-match org-link-bracket-re l) > + (match-string 1 l)))) For safety, please wrap the matching into save-match-data. This is often annoying when calling some random function unexpectedly changes match-data. > +(ert-deftest ob-tangle/comment-noweb-relative () > + "Test :comments noweb tangling with relative file paths" > +(ert-deftest ob-tangle/comment-noweb-absolute () > + "Test :comments noweb tangling with absolute file path" Full stop at the end of sentence, please. Best, Ihor