From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id kOVCKS1Ll15RdgAA0tVLHw (envelope-from ) for ; Wed, 15 Apr 2020 17:58:05 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 6FNGADFLl16AKQAA1q6Kng (envelope-from ) for ; Wed, 15 Apr 2020 17:58:09 +0000 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 BA778941F4E for ; Wed, 15 Apr 2020 17:58:06 +0000 (UTC) Received: from localhost ([::1]:53456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOmIV-0005aQ-UE for larch@yhetil.org; Wed, 15 Apr 2020 13:58:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47884) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOmHz-0005aF-LY for emacs-orgmode@gnu.org; Wed, 15 Apr 2020 13:57:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jOmHy-0001jD-2F for emacs-orgmode@gnu.org; Wed, 15 Apr 2020 13:57:31 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:51893) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jOmHx-0001ib-7Y for emacs-orgmode@gnu.org; Wed, 15 Apr 2020 13:57:29 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 59E155C012E for ; Wed, 15 Apr 2020 13:57:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 15 Apr 2020 13:57:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=retrospec.tv; h= from:to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=fm3; bh=+YoYb8gEb/glw53vgiMtt5AyVe W7lPCBZ5y7GKgiQOQ=; b=ih53cIJABoU7UlR1H6t9st5tNvT/uVXjQ08F44qD+3 yiorNY0K5WE46Ix0lis49cT8K5nAEsTZCOhLQt7AD2Y19hOddjQySVgQCWjFLssQ 4iK8Fd0FmPJA5b9cMgiTbNWItoS0IzA1A4JiP+vtN74gxPNv37yInE53srDMtgKG RWrPZR3UUEeqqjqh6SSzay6KvPK3lDqrk7HeGnI/8K8afFJm2Xhf5iYzEXjlWXrs rmAn4q/Lsrby/ulnWntIc3yPz39y2MJVTe574wmN7wfpoqstWUSBNxQfkAIS2/6L lnZ50NkTIzdmuucszREPXI5Upk0FqIwOtZ3IW+3nu+Pw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=+YoYb8 gEb/glw53vgiMtt5AyVeW7lPCBZ5y7GKgiQOQ=; b=Hu5rfco2S8T6mu9sCDQouZ iEvxSLdQZSKuWzt1k7cPkCnX9Cp70WXzzxvfxNlR7t3TM5sN2gP2wPYnD+kXf7VK KQAEPsooJR9hYOLz1quGNgtQvh+PM8Op7ChIEZLGiBS+oBCiFIWMqBvZisfMQZZJ jA14kCQOzmlnyQrY1yUhn6MTRg2ZsJsdapSaIfzSxHLjvCVTNErswXto+L0/HceK hz5MdudxTimti+WXbZ8lHqqyMGFh8iusr/zUcIOuQ/Y5IT5bG+5PKUTpdy/wRS7f 067j8gzU+SN30cSwPtG0Br79pqBxkZz+xmhzh+u4EHKBhPMqji/oCdFalutREi6A == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrfeefgddutdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpegfhffvufffkfggtgfgsehtqhertd dtreejnecuhfhrohhmpefkrghnucfguhhrvgcuoehirghnsehrvghtrhhoshhpvggtrdht vheqnecuffhomhgrihhnpehorhhgmhhouggvrdhorhhgnecukfhppeeijedrudekledrhe efrdegtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehirghnsehrvghtrhhoshhpvggtrdhtvh X-ME-Proxy: Received: from phaktory.retrospec.tv (c-67-189-53-40.hsd1.or.comcast.net [67.189.53.40]) by mail.messagingengine.com (Postfix) with ESMTPA id A2B673280063 for ; Wed, 15 Apr 2020 13:57:26 -0400 (EDT) User-agent: mu4e 1.0; emacs 26.1 From: Ian Eure To: emacs-orgmode@gnu.org Subject: Bug: org-id-add-location fails when cloning a subtree [9.1.9 (release_9.1.9-65-g5e4542 @ /home/ieure/.emacs.d/straight/build/org/)] Date: Wed, 15 Apr 2020 10:57:24 -0700 Message-ID: <87a73caayj.fsf@phaktory> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.27 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 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-Scanner: scn0 X-Spam-Score: -0.71 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=retrospec.tv header.s=fm3 header.b=ih53cIJA; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=Hu5rfco2; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [-0.71 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.57475725707563]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.27), country: US(-0.01), ip: 209.51.188.17(-0.57)]; TO_DN_NONE(0.00)[]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; DKIM_TRACE(0.00)[retrospec.tv:+,messagingengine.com:+]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; TAGGED_FROM(0.00)[larch=yhetil.org]; FROM_NEQ_ENVFROM(0.00)[ian@retrospec.tv,emacs-orgmode-bounces@gnu.org]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[retrospec.tv:s=fm3,messagingengine.com:s=fm2]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; DMARC_NA(0.00)[retrospec.tv]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_SEVEN(0.00)[8]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: HZzNnBEIJSO3 If you have a subtree of entries with :ID: properties and call M-x=20 `org-clone-subtree-with-time-shift' on it, an error occurs: Wrong type argument: stringp, nil This is due to the interaction of=20 `org-clone-subtree-with-time-shift' and `org-id-add-location'.=20 When the former is called, it creates a temp buffer to operate on:=20 https://code.orgmode.org/bzg/org-mode/src/master/lisp/org.el#L7801 Then calls `org-id-get-create':=20 https://code.orgmode.org/bzg/org-mode/src/master/lisp/org.el#L7808 Which calls `org-id-get', which calls `buffer-file-name', which=20 evals to nil, because no file backs the temp buffer. That nil is=20 then passed to `org-id-add-location':=20 https://code.orgmode.org/bzg/org-mode/src/master/lisp/org-id.el#L277 Which unconditionally calls `abbreviate-file-name':=20 https://code.orgmode.org/bzg/org-mode/src/master/lisp/org-id.el#L575 Which signals the error. I=E2=80=99ve confirmed that this is still a problem in the 9.3.6, which is= =20 the latest release, as well as Git master. A simplistic fix would be to swap the let and when lines in=20 `org-id-add-location': diff --git a/lisp/org-id.el b/lisp/org-id.el index 1ff433bd8..945a9a1f6 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el @@ -572,8 +572,8 @@ When FILES is given, scan also these files." (defun org-id-add-location (id file) "Add the ID with location FILE to the database of ID=20 locations." ;; Only if global tracking is on, and when the buffer has a=20 file - (let ((afile (abbreviate-file-name file))) - (when (and org-id-track-globally id file) + (when (and org-id-track-globally id file) + (let ((afile (abbreviate-file-name file))) (unless org-id-locations (org-id-locations-load)) (puthash id afile org-id-locations) (unless (member afile org-id-files) However, this causes a more subtle bug, which is that the IDs of=20 cloned subtrees won=E2=80=99t be tracked correctly. Perhaps a solution to= =20 that is to use an indirect buffer of the source when cloning,=20 instead of a temp buffer. Emacs : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, X toolkit,=20 Xaw3d scroll bars) of 2019-09-22, modified by Debian Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @=20 /home/ieure/.emacs.d/straight/build/org/)