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 gCpiDMak6WIlSAAAbAwnHQ (envelope-from ) for ; Wed, 03 Aug 2022 00:27:18 +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 mOBDDMak6WIOfAEAauVa8A (envelope-from ) for ; Wed, 03 Aug 2022 00:27:18 +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 D14B53E022 for ; Wed, 3 Aug 2022 00:27:17 +0200 (CEST) Received: from localhost ([::1]:51658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJ0M8-0003I9-CO for larch@yhetil.org; Tue, 02 Aug 2022 18:27:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJ0LF-0003Hq-IM for emacs-orgmode@gnu.org; Tue, 02 Aug 2022 18:26:21 -0400 Received: from mail-0301.mail-europe.com ([188.165.51.139]:42310) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJ0LC-00038V-En for emacs-orgmode@gnu.org; Tue, 02 Aug 2022 18:26:20 -0400 Date: Tue, 02 Aug 2022 22:26:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1659479173; x=1659738373; bh=bx5C6pXyD9dVtlI1MPEqq2qZUdUd7nUGr4yCYvYGiSI=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:Feedback-ID:From:To:Cc:Date:Subject:Reply-To: Feedback-ID:Message-ID; b=ecf5F7GCySQN1++nP8WCBFUY2Usaq1UxFaQmplJgn+eNms/BO9j/1g+oBM8t4u0lo rP2607qq7D/ybHf2HEgs5TAU0R+R+l4nocWWndMVX+Sp4N871vTNiVfm+lr+Dn7KQs r4iL+mNRBLoujzd5iogtQmG2YA6pRaOoYg7Hyjtt0m0DNa+EknfiNO9NQSpgfHKDqN S2LUx+Mq4YUTR7EwfJxnDdZpDs6tYRk6bzyipayhONx/uazrP9rp2PETVGWcOeaRcB jf5bWxIKNgTcmDWTa8FhEDuqsvF3QSTn+R3dpeGe/fbboozJ9weErfb2TOIAaOIEfV cDeU9Pw5eJB6w== To: Ihor Radchenko From: Janek F Cc: "emacs-orgmode@gnu.org" Subject: Re: [PATCH] Re: [BUG] org-attach-id-ts-folder-format fails on customized IDs [9.6 (9.6-??-2e9999783)] Message-ID: In-Reply-To: <87k084v1wa.fsf@localhost> References: <87k084v1wa.fsf@localhost> Feedback-ID: 17130000:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=188.165.51.139; envelope-from=xerusx@pm.me; helo=mail-0301.mail-europe.com 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, 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: , Reply-To: Janek F 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=1659479238; h=from:from:sender:sender:reply-to: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=bx5C6pXyD9dVtlI1MPEqq2qZUdUd7nUGr4yCYvYGiSI=; b=kvzIWAcd/kE4QDTS+hbvK9mKO2VQFQafIj7AkRp529bSSEhVrZWtfVEQtnTei69BTwpV+Z LliTuc96kiIgE2i/HMZHvaJJt7g73jb+CRV6PUiEsiAbNvL8ybD36jaFSwRz4Ko3sg6skv +FwpC7BO8Y2Ty6LSAowqr8VAruyI4JpTNXT2hPeIXKmShIAXl8BoSpmQ27+4RiroZKYmqh TLbZ/4xkQ9JkE0s9K1uJBZFXhQR6QRtYFuvjg/JLndnCxE0u+pXm4UStpA0lnzIEg1QU61 GsVaaKpLYUEPziNr0nAcqWBYFxLlNa6Q0nvsq912OkK3/ju/BE4QLXq3B6tdAw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659479238; a=rsa-sha256; cv=none; b=RTuzezZJi9Db18U6H9x5/VDV/Fxy09QFmfzH2hFBVnN3mSm99sy49kO9loKOsJbJjfQ+YY T3x+15TBsLz2Ap6pciBd+hEUeNXYlkHO4ux1y0pZk238mUiT/9IvXvY43kACPW6HhIT1o3 2zADyGJhGPXbqbf3mN/7sskTYb6FqY5UhHjtKYSF5aMQyFWQvJCP1uUrxGRnQA3UoJjs6G yoZhaOdNCbghNLYS3+/UdhujERd0xJ+IPldgoS+uORmzk6QSVKld0j142tibBc4K0s577c eNjmqAQYTZMzbOYr5Sr7YUWi4/HMGNBPfZgjMwaUbaUHIEQWCVpsIbomS9YC6A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=pm.me header.s=protonmail3 header.b=ecf5F7GC; dmarc=pass (policy=quarantine) header.from=pm.me; 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.92 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pm.me header.s=protonmail3 header.b=ecf5F7GC; dmarc=pass (policy=quarantine) header.from=pm.me; 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: D14B53E022 X-Spam-Score: -3.92 X-Migadu-Scanner: scn0.migadu.com X-TUID: bauIQQR5cZ90 Just now had a closer look at your patch, and I don't like the hashing. My whole idea customizing ids is to make the file structure useful by itsel= f, too. This is how I patched it for me: (defun xf/org-attach-id-folder-format (id) "Translate any ID into a folder-path." (format "%s/%s" (substring id 0 2) (if (> (seq-length id) 2) (substring id 2) id)) ) (setq org-attach-id-to-path-function-list '(xf/org-attach-id-folder-forma= t)) ------- Original Message ------- Ihor Radchenko schrieb am Samstag, 23. Juli 2022 um 07= :21: > Janek F xerusx@pm.me writes: > > > When setting org-id-method to 'ts or 'org, > > org-attach seems to use org-attach-id-ts-folder-format > > to create its hierarchy. > > > > However I tend to customize IDs for important files by hand, > > causing any attempt to use org-attach on that file to fail > > if the ID is shorter than six characters: > > > > org-attach-id-ts-folder-format: Args out of range: "ftt", 0, 6 > > > > This method should be adjusted to handle non-ts-ids just as well, > > as org-id-method does not dictate the format of existing ids. > > > Thanks for reporting! > Tentative patch is attached. > > I have added some fallbacks for the default attach folder formatters, so > that they can work when the ID does not conform to specific format. > > This change is somewhat opinionated, so feel free to suggest alternative > solutions/fallback options. > > Best, > Ihor