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 GM/pOEfkaWO0cQEAbAwnHQ (envelope-from ) for ; Tue, 08 Nov 2022 06:08:24 +0100 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 IKGrOEfkaWOK6wAAauVa8A (envelope-from ) for ; Tue, 08 Nov 2022 06:08:23 +0100 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 3B1D3903C for ; Tue, 8 Nov 2022 06:08:23 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1osGpq-0002AB-Mo; Tue, 08 Nov 2022 00:07:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1osGpp-00029m-0P for emacs-orgmode@gnu.org; Tue, 08 Nov 2022 00:07:41 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1osGpj-0001Js-Fn for emacs-orgmode@gnu.org; Tue, 08 Nov 2022 00:07:40 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 47C6F240103 for ; Tue, 8 Nov 2022 06:07:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667884053; bh=h9cLlvMimzIITkZKJ3iu17Gfm/7D5wQCLVK3d5hcNec=; h=From:To:Cc:Subject:Date:From; b=XbccU8xAkXPDAinHWVJB25TmUe9JelhA9lefUPJ/JxBowuEpVBFvy2G0mYXkt9Jrz 6T0O8IbNIETgUtXLlIYRHReBvd+BdPqvUHnWbGEQaJ2AOmUNkNOLtHcSzzeifxPOl6 adFQtapCXGOG0B5OFV0kY67pVy8dRCX8ee7bld+/TgSt4srnDm6TyZj+7xin+opr7r U/FBT4KJAOGE/DLoqjKDxhTMuOgzMxpKdwUV5vfzBI5tSZSwyhvAjocXE6BoaH84wX HrZnmXYs5ZN9CZMWDF0FRg/B1f3RsvKXMAw/TT0MUAHWH2fbojD6jKDXcuzZdgD4GL 1EHFANl21LrXQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N5x1F3sj2z6tmJ; Tue, 8 Nov 2022 06:07:29 +0100 (CET) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] org-attach.el: ID to path functions may return nil 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> <874jwiakpn.fsf@localhost> Date: Tue, 08 Nov 2022 05:08:04 +0000 Message-ID: <87y1sm11aj.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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-bounces+larch=yhetil.org@gnu.org 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=1667884103; 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=Tk7KRE3W5AFn3vOV3mWD1I4OORRwGW31kmLN5Kqa2A0=; b=HabNSHLCLZRJZqD6q7hLwOWamotC0k2aQYegSvbzA6neH6bmsWQ10TWPGIgkeF9MfCNCLU h0Q08Y8D1TRhThfvwwazGrPlzdvhzNLolR50UvHE5ep1/lvatAuzzcgq48FO+9q4nrD1In gVLkq8uUfexra/iAfgBSSaUJ9E1faa8KoNgCB9tf0OS1XRS/3TAHRv2HZsu/JY1JXCq1cd OmhwsYXEbZkHhUMuzjlGLuMRVI3bZtjEeBhY6hx/UPGaOkXcwkfoK0lJFqsk0uaCQNl8q1 EkCA2VhpycW2BwoP5vLfLErOs4XigHfYGQG1LZ74wGYEsm+erdxuZsxfHbQO+w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667884103; a=rsa-sha256; cv=none; b=lmTqDtuNhDQ1gtZ0C2zgdIs2W3p1wyuIfOlFF8AJBiqFTsl3la++Dm+Nxinv6JBcHeD2qt Q40xmGqtEKX2w8dahGGaoPl/1c4tfy38BUb2Ehn/eNCaWm7Z9ueFbIh9RQp9WWtVz7T1Kr vP/bfnOzUEXz9QF8UkNSV/2vC78SVuXRarIF4oeyEoxKbKu7Fxkx4Ebw0Cr2XyQ4Z3Pubx lvQfZvwxb8meXNVMlkJu/qgpi/EhYO4Mz+f7D28ZoPNkAxHAB6DiOMHOOaCwTaTk+mojn4 h0QL3P68bwQNI+mYCnSvRwIsnPhePA3cGHGlAoqgk+kBDKchKUGonOYdG27lMA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=XbccU8xA; dmarc=pass (policy=none) header.from=posteo.net; 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.51 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=XbccU8xA; dmarc=pass (policy=none) header.from=posteo.net; 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: 3B1D3903C X-Spam-Score: -3.51 X-Migadu-Scanner: scn1.migadu.com X-TUID: mai+oqV6Q0bV Max Nikulin writes: >> AFAIU, your version of `org-attach-dir-from-id' may sometimes return >> nil, which is neither documented > > "otherwise independently of TRY-ALL > value return the first non nil value." > > indirectly assumes nil. It may be made more prominent. I feel like this makes the docstring confusing. Note that `org-attach-id-to-path-function-list': List of functions parsing an ID string into a folder-path. The first function in this list defines the preferred function which will be used when creating new attachment folders. All functions of this list will be tried when looking for existing attachment folders based on ID. The docstring implies that only the first function will be used to create new attachment folders. With your patch, it will no longer be the case and may surprise users. You at least need to update the docstring. > If TRY-ALL is non-nil, try all id-to-path functions in > `org-attach-id-to-path-function-list' and return the first path > that exist in the filesystem, otherwise independently of TRY-ALL > value return the first non nil value. This is a very long sentence and I cannot clearly parse which sub-clause is referenced by "otherwise". >> nor expected by the callers. > > I see 2 direct callers and I am not aware of any problem with them. > >> In particular, `org-attach-dir-get-create' will throw unhelpful "No >> attachment directory is associated with the current node" error. > > * H short > :PROPERTIES: > :ID: ec > :END: > > if: No attachment directory is associated with the current node, adjust=20 > =E2=80=98org-attach-id-to-path-function-list=E2=80=99 > > I do not think this message is unhelpful. With your patch, such message will be displayed even when `org-attach-preferred-new-method' is set to something other than 'id. And the message will be wrong then. > +(defun org-attach-id-fallback-folder-format (id) > + "May be added last to `org-attach-id-path-function-list'. This is not a proper first line in a function docstring. First line must describe what the function does. --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at