From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 WJwWGL8ZPWPMPgAAbAwnHQ (envelope-from ) for ; Wed, 05 Oct 2022 07:44:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id ECNHF78ZPWMV1AAAG6o9tA (envelope-from ) for ; Wed, 05 Oct 2022 07:44:31 +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 017DA20E5E for ; Wed, 5 Oct 2022 07:44:31 +0200 (CEST) Received: from localhost ([::1]:49166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofxCo-0004u5-3R for larch@yhetil.org; Wed, 05 Oct 2022 01:44:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofxBm-0004sf-BK for emacs-orgmode@gnu.org; Wed, 05 Oct 2022 01:43:26 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:46777) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofxBj-00004x-Qa for emacs-orgmode@gnu.org; Wed, 05 Oct 2022 01:43:25 -0400 Received: by mail-pf1-x435.google.com with SMTP id y8so571331pfp.13 for ; Tue, 04 Oct 2022 22:43:23 -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:subject:date; bh=MrE7DW+YxR1kRWbZiKJMQHKz05lzSAr8/082KWiUhnU=; b=fv+BMpz6zbFnwtEr0sBVbMwf5SNBMVdFWmOIf638m4q8G/UtnWhz4SdjGr0tKz/jnM Z+P/ANbbJiDZYyCk5Gj25Z8qdfi1AHoj1tfVh6DYONpPw1wR7F8kMIUHIa9FfLvhzwon hzTSUlZYMOi06GCkYVtCyCZmUpatvdo8bdfst0M1vjhuF/oywPQ7Z6yGZWwOD1y7sGN7 LwSB8bfc4MhJj1ibzItTjUDEDlLGJHn3PqTpkY6q+t+i9Uu8E9RcpctkWAuB3GphGrjs e6s00AEyvTz5UwdkSQk5PZNBe2uqEqB1yO1LOX46J1AANP5koI+dE3UWCIRakkQJScmc U4BQ== 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:subject:date; bh=MrE7DW+YxR1kRWbZiKJMQHKz05lzSAr8/082KWiUhnU=; b=rC/uqTa5O/wWFILOL2qEcN3Fs2L8JblDEBYSd2V4GYW8T2LpIBA53M07j2/vLpYF4y VrnQrqpIlnNscSXxvonpi591P+mDxkPi3SJjK+HA7tEjHSbXVm0/VzHaENbcYkewJSMv gMV6yz0rog9idWwBEm+agO22WIneYeU4spe0e6+tj1EPd9/euibqOaDqLVqCqyYY14nh uP9gKIG27zRwVavH5xwnO6zdeZ77fdrwgIAkWRnWITvO3O78719hXNWjhyMhzyp8cGVG aH/a7GIUh8pT7OPl6pK/VnWovKo5wWIej6CaMXvXOfoKQy0K3ypVRqa3hJEfjlQUdikx mdFQ== X-Gm-Message-State: ACrzQf0D4UmaXA+tY2ioswGj2/cvIpEg51UrABDWclSFvl9t+rg0Ugmw YX/kC8whVo0uBOzXBbim99w= X-Google-Smtp-Source: AMsMyM4WNW9ZoDuHZ/+i4huzkm876FwloGWA9oEg/UDUAsCUpmbqgYmtyyT/Zqqr4byOTYuj+j6EvQ== X-Received: by 2002:a63:5511:0:b0:439:12f6:fb9a with SMTP id j17-20020a635511000000b0043912f6fb9amr27122600pgb.197.1664948602397; Tue, 04 Oct 2022 22:43:22 -0700 (PDT) Received: from localhost ([2409:8970:af2:32f:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id j16-20020a170902da9000b00176c6738d13sm9913559plx.169.2022.10.04.22.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 22:43:21 -0700 (PDT) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH v4] [BUG] org-attach-id-ts-folder-format fails on customized IDs [9.6 (9.6-??-2e9999783)] In-Reply-To: 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> Date: Wed, 05 Oct 2022 13:44:04 +0800 Message-ID: <874jwiakpn.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=yantar92@gmail.com; helo=mail-pf1-x435.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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 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-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664948671; 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=MrE7DW+YxR1kRWbZiKJMQHKz05lzSAr8/082KWiUhnU=; b=sqSoUKJ1XC4vzgW4/x/zhrZuZEm5euUeDnakswzLfsrpzYuyMK9wG1wR+cFWIX4UBRzwZ1 Ksr5qpJ7/C6087vJHrtfPynE+CmHFetzqnriR55P8s2aRIAA0VwIqOut9/1BwaIZOVZmV2 o1EqsMWG9wC45U5pItQCMtWGqKm6N4o0Lwke47y6hyF2Br4CJW98vsQrix1FLzpiPoWvnZ 2IwMxfD8PLTRPT2I2CXrZJKyaeRluTfw/5PoMH7KYhsEnrhS1CGVnjhlsALljX9k9IQ3oY KFGxpyovE2dSdnWvn9dOIaPKK7dzkFTS/Z0FNxn0TYJy2brBrINv5/cG6/4Rbg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664948671; a=rsa-sha256; cv=none; b=kYkhelzuLRkE5kLrG0MA4vphn43kszaXEFHUQEcdmKssqE5LjRDD+2iPEiXBajibXXa+dK XaDY+zbFpTwPni9j3t+ktqKFjt7QJwayiMG10wy68onvZ5pCvpr2a5FEMfcfUohAVQyKkw sh6dPh635CwljE7Us8R0V60d4hfiSoRLzZ4GjhNPFl6l2bwSg651LJBqUv1CY4gwcIW0fT 4kPPgM+MenA5sewP7NcZg+xL4cXRfmmOqotvq5NruoyNLTZ9Pg1xbAmYi44p7RcN5m48Kp 6+q9arpRbTPPE85HEC9bw7L0L+uTNWD0uFhHh09FQfXMEnMhnH2pA0TUmcY3Pw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=fv+BMpz6; 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.16 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=fv+BMpz6; 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: 017DA20E5E X-Spam-Score: -3.16 X-Migadu-Scanner: scn0.migadu.com X-TUID: 86c2XiLO8Idm 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. AFAIU, your version of `org-attach-dir-from-id' may sometimes return nil, which is neither documented nor expected by the callers. In particular, `org-attach-dir-get-create' will throw unhelpful "No attachment directory is associated with the current node" error. `org-attach-dir' appears to handle nil return value fine. I will be happy to merge a proper patch upon addressing possible pitfalls. I do not feel strongly about my variant vs. yours. > 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. `org-attach-dir-from-id' is a public function, and we cannot change its return signature drastically without breaking backwards compatibility. If we do want to change the return value, the current function name should be obsoleted and an alternative function should be introduced. I do not feel like the benefits are strong enough to justify such a drastic measure. `org-attach-dir-from-id' is only used in two places in Org code - I see no clear benefit of returning multiple paths. -- 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