From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 oHyoHHoGbWJaVwEAbAwnHQ (envelope-from ) for ; Sat, 30 Apr 2022 11:50:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id iYiFHHoGbWKg0wAAauVa8A (envelope-from ) for ; Sat, 30 Apr 2022 11:50:50 +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 2545828063 for ; Sat, 30 Apr 2022 11:50:49 +0200 (CEST) Received: from localhost ([::1]:46908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nkjkW-0001Zu-NZ for larch@yhetil.org; Sat, 30 Apr 2022 05:50:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkjic-0001Zk-BC for emacs-orgmode@gnu.org; Sat, 30 Apr 2022 05:48:52 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:35837) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nkjia-0005ix-Jo for emacs-orgmode@gnu.org; Sat, 30 Apr 2022 05:48:49 -0400 Received: by mail-pf1-x42e.google.com with SMTP id t13so8803141pfg.2 for ; Sat, 30 Apr 2022 02:48:47 -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; bh=D7uf5HILjKl5hdHCdaTXdgDVFcsgj9/1e1Igq31Iymo=; b=LyMZQkS3KeNI0ho3GBwLNJ4yg+nPxQ3ue1T2JXqXgC5SdGMOSVLfDUQlB30Bw1qsRW klIlZl9/5BnC8hh77e8Tr91n6CnuCloKpxYh3ex7TBqt9K9M3Yg+P51j/KPa5LJKwUCu qLu3UToyAvpI09CIFNRn/GOEFQasOqei3hMKFYfWOpQT4c1OIJu8E0xGmiWnqx+fSOkK 4pm+XVsX5hQ2fKZNtha6PucQdEqs5wwenjjoZF4HVJLV0sSWN+Waj40ZdkR3ni7d2FJJ g8biJhrlmTCuUKX3mFU1kP3HzTqnYWDbj/kzbcQNS2riqnxq1r5KGUii7XfqKpBM9uwa gI9w== 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; bh=D7uf5HILjKl5hdHCdaTXdgDVFcsgj9/1e1Igq31Iymo=; b=uDQWGX6augVBXU6+bOAyJePIv20uGIav9YjAhl2qeYURJmFNTDN9wyBMgKCp8kA/sm 0Akq5Bek7eR/jGXobnk3l1OsRlvD4+P7JcbfW9SFp5G8yDOsnKMnS6BLHLg6xMKjcQUG qvD+Yjs8JWyf9FeNWccMSyvDPtDRFOILg2svMvqhXAaiLkIXYaLtRfcCMG5dhJB/SpMX cDyck4Oz+wYqW5D0kyPbW2St1PExULg3/OdXzMYbyv9fX9ZwGyJHlMZdaBNnzn/4lOWq DDOcl8TWqmPHg3bc9a0qbBS/ycAWJtqths3EB/M9NCrBkfvsd2baISzGrzhL7db8pGTC A/yQ== X-Gm-Message-State: AOAM531bgEp1wHPDmW5sD+s3u0y5H8KtILNzhhF8+K5vYZEkBHu8zLPQ ORlEceIgldGAweOLed03oNY1LkS/+VkooYxO X-Google-Smtp-Source: ABdhPJwoWh6WCgyFUC/BlvGrLVqWAH7qGOhvfKXhY99s3cQ0eE5tIf8bl71i/Clax7e+DqTR+mr4qg== X-Received: by 2002:aa7:9085:0:b0:50d:35ae:271 with SMTP id i5-20020aa79085000000b0050d35ae0271mr3146970pfa.42.1651312126086; Sat, 30 Apr 2022 02:48:46 -0700 (PDT) Received: from localhost ([63.143.61.57]) by smtp.gmail.com with ESMTPSA id x6-20020a17090a46c600b001d960eaed66sm11861993pjg.42.2022.04.30.02.48.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Apr 2022 02:48:45 -0700 (PDT) From: Ihor Radchenko To: Andrew Arensburger Subject: Re: Patch: bug in template expansion in org-fill-template In-Reply-To: References: Date: Sat, 30 Apr 2022 17:49:34 +0800 Message-ID: <877d7699zl.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain 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, 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: , Cc: emacs-orgmode@gnu.org 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=1651312250; 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=D7uf5HILjKl5hdHCdaTXdgDVFcsgj9/1e1Igq31Iymo=; b=SgDtT1VkNnYs38CxmSjNx3oHfLreRbCes5vbR90g4VF75irZMgQWYB269dnxb/f0rNZf7P 9KXMg3fCQgWuFbouh2hPTnxLWJHlRe6lyRC5bU7yQO1F9YTAk/y0GqKI/AGatQLt5RMmag xRP7f2HN7M+uM4j3WSzRtmrZYsFwIuox9BW9spmdm00Nlb2ypuz4bZWPhLXe8pld3NASIA qxWjucfBF6sPqscWSCKGJLBnjt25guaB4oQMTHrqMqbnq0Rvm0L0fiyVkFqVmsCoILaBvh hu2bXUGFSSXtSMkUmbWFlzFzY3rn+TyThiVK/J5u4zu2aYqf+bLBLnMW5o2j+Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651312250; a=rsa-sha256; cv=none; b=CzBFgsgbrozblaeI6HPiZ18hazNCOCcdbBPi3vsupYIiVO+8POC3Q47VSLuVgQvcmMyqKv 51qj9FDv2uZUfdHJ+hGjIgH7IiEYQmcJoiGTzKfA2Wl/sXzxgEEPgeGHrrkG8+WAqUkzlu vNUXfEGWtEoP7chesQs3iGYB1gJM1A5LuXVIAeRoEHkVHjk8a6BFnLncUBatOl/yPgfcZo wJ9qSh0kcIW4rwLnhvyILV9DqG5X8SuzWs2US/nVp3qJG52olX4W8cgtwzKJq5eTwifuSI DoPw4b5lgQCJsUQPWne80SHv85jGwelAPF2kL20eiuZX/zxlTkaHUmH/lMiYzw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LyMZQkS3; 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: -3.50 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LyMZQkS3; 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: 2545828063 X-Spam-Score: -3.50 X-Migadu-Scanner: scn1.migadu.com X-TUID: HUX14HQzckrs Andrew Arensburger writes: > There appears to be a bug in `org-fill-template' (in lisp/org-macs.el): > keys to be expanded are sorted by increasing length, so that "noweb" is > processed before "noweb-ref". As a result, if a template includes > "%noweb-ref", `org-fill-template' will expand it as "%{noweb}-ref" > rather than "%{noweb-ref}". > > As far as I can tell, this bug has existed since `org-fill-template' was > added, in e8ef16306ca56af2dceb9e2be0b57c930e9b5584 . I tried to trace it > as back as I could, to see whether there was a good reason for sorting > keys this way, but couldn't find one. > > I'm including a patch with a test to find buggy behavior, and another to > fix it. Thanks! Applied to main as 82a09ba0a and 4a30e8cc0 with some amendments to the commit messages: Fixed "." in the commit summary and added " " between sentences; (2) Added TINYCHANGE cookies as you do not appear to have copyright assignment. Note that you may need to do copyright paperwork if you decide to contribute in future. See https://orgmode.org/worg/org-contribute.html#copyright Best, Ihor