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 qG+dHZVbPGOKPgEAbAwnHQ (envelope-from ) for ; Tue, 04 Oct 2022 18:13:09 +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 cH24HZVbPGP1hAAA9RJhRA (envelope-from ) for ; Tue, 04 Oct 2022 18:13:09 +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 0E94226847 for ; Tue, 4 Oct 2022 18:13:09 +0200 (CEST) Received: from localhost ([::1]:44192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofkXb-0001y8-4R for larch@yhetil.org; Tue, 04 Oct 2022 12:13:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofjpc-0005Vj-8k for emacs-orgmode@gnu.org; Tue, 04 Oct 2022 11:27:40 -0400 Received: from ciao.gmane.io ([116.202.254.214]:50752) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofjpa-00054Y-3x for emacs-orgmode@gnu.org; Tue, 04 Oct 2022 11:27:39 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1ofjpX-0006UX-Kp for emacs-orgmode@gnu.org; Tue, 04 Oct 2022 17:27:35 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Max Nikulin Subject: Re: [PATCH v4] [BUG] org-attach-id-ts-folder-format fails on customized IDs [9.6 (9.6-??-2e9999783)] Date: Tue, 4 Oct 2022 22:27:29 +0700 Message-ID: References: <87k084v1wa.fsf@localhost> <871qtxhsm6.fsf@localhost> <87a68ce32u.fsf@localhost> <871qtodygs.fsf@localhost> <87v8qz9zui.fsf@localhost> <35cbf452-c3ed-d97f-db96-dcae57463eff@gmail.com> <87wnbc7ltm.fsf@localhost> <87bksn1nl1.fsf@localhost> <87sfk6zixs.fsf@localhost> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------45x5n52jkTuxJeXlhxI2afl0" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US In-Reply-To: <87sfk6zixs.fsf@localhost> Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-2.449, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664899989; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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; bh=wtJjEGTQA0fVHmvQ3CA3B+VjY35YqFwPURto/atg4Hc=; b=XKWFjm+MXraktTudBKAUQsgs+0trl84XJHyh/v1bLZlSrXHDcPrA/ioDoHwn0AEUdg+9wT 4MPgzns1XsfhUp0OEewl5ed5LsbWHtzPRYOqjt+KVnd/LAZJgc2KCWcGdkfip9SH+95Pnr jahfrwrWezpVjB4NoZ/fnxK3bsgUuoY6TJ0sDthf7hzulK9Yj227+ah9TGRytfRz0n6CDy fKyA/fmIxCatvnN+LqPmBZlE8WZ5nQEp2RFIbjQa2u9Ocbx66a6ACM5+EEfSAZwxempcnk FsxIz4WNNgYiZ8hWWJWvEPwGVZ7Z5EIPMbI1LWwVOM/HoP3NhXMcokooj/1knw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664899989; a=rsa-sha256; cv=none; b=Z3Y78VB3cQ08LP9N9s6rEmT/cVEkWrbT4Xg4jncbTme1dgRIFWK0hH4xpFRbXqLYjZ+nZJ IrqSf3DNlCln4JgZqNHZ4T4XY2iExzONNyu1obaaYriufMAAUv9oBB9pkTcY6WngrntAgD kvuST0+ihq+ypjwbWJUQyfOyTdR6H7D8IdHXR9mUNfUSUK+xSECiYTeNPWsdbxXGb4HW/C myA+zMxaePDKQ3NwrcmyDwrD9UfRWX5gVEuGq4uNV5muAdHPKuvXWO33sqcb8L/Kqx20+w alyo9PbEMjf7fk7MIfJFkY3gqo5v16AZfzuqbu1VBCW7qgpp98qt9ZNbxTzabQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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: 5.44 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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: 0E94226847 X-Spam-Score: 5.44 X-Migadu-Scanner: scn1.migadu.com X-TUID: BRagiCI9fdvK This is a multi-part message in MIME format. --------------45x5n52jkTuxJeXlhxI2afl0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 02/10/2022 16:14, Ihor Radchenko wrote: > Ihor Radchenko writes: >> Max Nikulin writes: >> > The new version of the patch allows all but first function return nil. > See the attached. > > Let me know if there are any other objections. Ihor, sorry that I left your earlier questions with no response. I hope, the attached diff may illustrate my ideas better. I have not tried to run it though, so it can be full of stupid mistakes. I suggest to ignore nil values completely, but maybe I missed some use case. Actually I suspect the if the `org-attach-dir-from-id' function returned both first and existing directories, the code of callers would be clearer. --------------45x5n52jkTuxJeXlhxI2afl0 Content-Type: text/x-patch; charset=UTF-8; name="alt-org-attach-id-dir.diff" Content-Disposition: attachment; filename="alt-org-attach-id-dir.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpc3Avb3JnLWF0dGFjaC5lbCBiL2xpc3Avb3JnLWF0dGFjaC5lbApp bmRleCA4NTA5YTY1NjQuLmM0ZDA0M2ZiOSAxMDA2NDQKLS0tIGEvbGlzcC9vcmctYXR0YWNo LmVsCisrKyBiL2xpc3Avb3JnLWF0dGFjaC5lbApAQCAtMTYzLDE4ICsxNjMsMjcgQEAgV2hl biBzZXQgdG8gYHF1ZXJ5JywgYXNrIHRoZSB1c2VyIGluc3RlYWQuIgogICAiVHJhbnNsYXRl IGFuIFVVSUQgSUQgaW50byBhIGZvbGR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GlzdCkgaWQpKQorICAgICAgICAgICAgIChjYW5kaWRhdGUgKGFuZCBuYW1lIChleHBh bmQtZmlsZS1uYW1lIG5hbWUgYmFzZS1kaXIpKSkpCisgICAgICAgIChzZXRxIGZ1bi1saXN0 IChjZHIgZnVuLWxpc3QpKQorICAgICAgICAod2hlbiBjYW5kaWRhdGUKKyAgICAgICAgICAo aWYgKG9yIChub3QgdHJ5LWFsbCkgKGZpbGUtZGlyZWN0b3J5LXAgY2FuZGlkYXRlKSkKKyAg ICAgICAgICAgICAgKHNldHEgcHJlZmVycmVkIGNhbmRpZGF0ZSkKKyAgICAgICAgICAgICh1 bmxlc3MgZmlyc3QKKyAgICAgICAgICAgICAgKHNldHEgZmlyc3QgY2FuZGlkYXRlKSkpKSkp CisgICAgKG9yIHByZWZlcnJlZCBmaXJzdCkpKQogCiAoZGVmdW4gb3JnLWF0dGFjaC1jaGVj ay1hYnNvbHV0ZS1wYXRoIChkaXIpCiAgICJDaGVjayBpZiB3ZSBoYXZlIGVub3VnaCBpbmZv cm1hdGlvbiB0byByb290IHRoZSBhdHRhY2htZW50IGRpcmVjdG9yeS4K --------------45x5n52jkTuxJeXlhxI2afl0--