From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id KJL2CBVq+GKYHgEAbAwnHQ (envelope-from ) for ; Sun, 14 Aug 2022 05:20:53 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id +G4SCRVq+GIjRgAA9RJhRA (envelope-from ) for ; Sun, 14 Aug 2022 05:20:53 +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 933B8F605 for ; Sun, 14 Aug 2022 05:20:52 +0200 (CEST) Received: from localhost ([::1]:53470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oN4BG-0004hP-5P for larch@yhetil.org; Sat, 13 Aug 2022 23:20:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oN4A6-0004h4-Ug for emacs-orgmode@gnu.org; Sat, 13 Aug 2022 23:19:39 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:42762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oN4A5-0001BM-A3 for emacs-orgmode@gnu.org; Sat, 13 Aug 2022 23:19:38 -0400 Received: by mail-pg1-x536.google.com with SMTP id 73so3950300pgb.9 for ; Sat, 13 Aug 2022 20:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc; bh=BW5B4D4KEUm51ItkLZLSKJTSEXfJwBZG5N1m4+6rQ+M=; b=koiLEzggm6+U3F9VkBnD13hO7McntZeYpN4dPCQMb/GXQ83VtfBXCFdni77EYfvNmK nZnpJziJ35UZtkpuFz6QNFoA6/0Jq8AwIeil1ikdNzwkoqamnvqb53RSLPpxRvWCcLbs nEYe6YeH75vJFnK9FZWw31Lege/T74oftXQxw+eKjeumjr7uMwWp1wzqSnnMYX/EUIMt 8fzCEgQb/4ckuKf2OmF8ucZKIuvcrex8Y3PbTvRi53nRan+dLLqMme6U8yvlN8ObrxXE 4C3hfHZbwtDacXaGZLuHzygj6D2ImHgSdt1SxAbJoeZueVrPEX4OBDHEnEWt+kMZ7Pvw +PmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=BW5B4D4KEUm51ItkLZLSKJTSEXfJwBZG5N1m4+6rQ+M=; b=VCs2mn3rBmU5AUwKOXTqAT9rCUG8Qm3RrBRfzGobk8mdNec9ZBDaOHSl5bieexN+Al dtJ/U9LFqXRwiyx+spNnLm89U8VAH2WW+HA10mtlD/UP+sg7ZFYiSF+jeBJuPe/PIMaN 0tLe66a57olgflYu3dCIiVGd3HKVqNP4Q9gmuWGv2AJwV5jqGnRytUqw89VKREi8L3Lb Qcc4M7/896ac0MQFb7YOm+ZxMBSbOijeBPkfsM24md6Upcq/ihpVXNOV1XPaelrG9cJ6 OtA7GqZnBXiaTbc6Q/0sed61VJJ/89XYStKgk7ZK/+IjgAbiZpUoMrDAecM1fysPbnnV CKRA== X-Gm-Message-State: ACgBeo2e8FNsDyazukgFMgs+FuJHBcOiWZB4Ufc6QQkBR37keSmIG5e6 A/DZHRn3UaSOGe//PNp0Q1CP6UUbnIETwA== X-Google-Smtp-Source: AA6agR6VhZX93WwgtabgIeENt9lHTFA2hTofi0jDHsYaw9r2RL9WGFVv01YCx8kmWrYjYiG79Py7hg== X-Received: by 2002:a65:6556:0:b0:41c:9c36:98fa with SMTP id a22-20020a656556000000b0041c9c3698famr9020113pgw.491.1660447175549; Sat, 13 Aug 2022 20:19:35 -0700 (PDT) Received: from localhost ([2409:8a70:2bf:80b0:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id j125-20020a62c583000000b0052e67e9402dsm4295437pfg.106.2022.08.13.20.19.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 20:19:34 -0700 (PDT) From: Ihor Radchenko To: Max Nikulin 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: References: <01070182484e44f3-f0fd271a-def3-4c86-961f-9a4bb63949d5-000000@eu-central-1.amazonses.com> <87wnbvtcz9.fsf@localhost> <87o7wr9zhw.fsf@localhost> <87o7wo7igw.fsf@localhost> Date: Sun, 14 Aug 2022 11:20:36 +0800 Message-ID: <87mtc71pff.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=yantar92@gmail.com; helo=mail-pg1-x536.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" 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=1660447252; 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=BW5B4D4KEUm51ItkLZLSKJTSEXfJwBZG5N1m4+6rQ+M=; b=XR0xgFs2EbyCHME/vPINurtqJM7uoQ8kxxr6Dz+wsom0a+J3Rx+WGYS83ScfLG2t3HCm5R +HhRxrYqvGxDeiCvpqZJWVA3WRhoAh84TmpxxW4IUwUxTyZ9aYeYppBZBLmOnVC4Iqw6Zo Yx0LCmPWhN5XSX5PKebxCjFscumvfVENBAGffDmKUlyiSbdgtIttqSYLyc+ccTMes8Rhsh v/Sw6v7TKDuo1mtaQkWGBQHfwsAYyja1D63TFoeKRk6F/ljtd5ojTgCwnf0u66+RSn0Mgb QnZa04UzjEkiC+34vh9ADzZpDywFncYt2xxWyNjzj1CCodczh5RFUy+a3cR6dw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1660447252; a=rsa-sha256; cv=none; b=JOnKIPpOmUHxsIRQq0HliZKLPizAy9nrkGMeE0XjWRmFU4kLjx6CYhPSP/xUjDrt3K/AiD FKkiDFRmckkvIOWvA1p+WwOsvNikLeHdbjq/qstTQnVbFp9A0pywbdaIrgV8luxY7jkf3l xsQHKTdp3VIGOZ96mFZ4kCI6yhol6t7IVX51WMebPuxp3ly0yMwXjlPIvETjQr7TE2Rfoa gDuopmtCc7vyZ0IHNYxLwkF0brOveRA80raGbo8EkxnrbM9jlJMHO7qVB23DYtxYXsp8jv u0nRY02doNyPScTUQhC4yzihOBABut/QKy6181pqSkiLLl+kJFPnTi0GUYdkNQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=koiLEzgg; 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: -8.66 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=koiLEzgg; 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: 933B8F605 X-Spam-Score: -8.66 X-Migadu-Scanner: scn0.migadu.com X-TUID: njXxGQDr7TNe Max Nikulin writes: >>> It looks like (string-prefix-p "file:" bare) but without the complex >>> regexp. I see, such code was used before. By the way, why it is "bare", >>> not e.g. "target"? >> >> match-end is used later in the code. Thus, string-match is justified. > > The matched string is always "file:", so there is no actual point in > `string-match'. It does not really matter however. > > (let ((params '((:tangle . "/home/user/file.el"))) > (type "file:") > (target "file:///dev/null")) > (if (and target > org-babel-tangle-use-relative-file-links > (string-prefix-p type target)) > (concat type > (file-relative-name > (substring target (length type)) > (file-name-directory (alist-get :tangle params)))) > target)) > > In the code existed before and moved by the committed patch I do not > like that "then" branch of the `if' form uses side effect of evaluation > of the condition. Sounds reasonable. Could you make a patch? -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92