From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id OBpBNUH7l2CjBgAAgWs5BA (envelope-from ) for ; Sun, 09 May 2021 17:09:53 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id yJHZMEH7l2DSegAAbx9fmQ (envelope-from ) for ; Sun, 09 May 2021 15:09:53 +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 6CB4019925 for ; Sun, 9 May 2021 17:09:53 +0200 (CEST) Received: from localhost ([::1]:33920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfl44-0002HV-L9 for larch@yhetil.org; Sun, 09 May 2021 11:09:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfkiw-0003pf-18 for emacs-orgmode@gnu.org; Sun, 09 May 2021 10:48:02 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:34443) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfkiu-0006oI-Ge for emacs-orgmode@gnu.org; Sun, 09 May 2021 10:48:01 -0400 Received: by mail-pg1-x531.google.com with SMTP id z16so11529998pga.1 for ; Sun, 09 May 2021 07:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6tGBN+zzYbWK2jK0y5GPUjPXMJuzyUfAtlopttoVK4E=; b=Txx4o/V2DJWNgLme7XoG/dcgLXLzGichgo87EE55ExC7s9nATsAuyfODsgg20RE9pw N38XYA4zml0k7ZEtB/TRC6yFQ1+QDxiXfzl+akkYeYzEHXmhfcuDlsFwUXNBsQ4DYozw QtAFDvxB5Ctvw5FQ11dOAF9XSWRHAOcNxKRWyDpoRh01BHb/AlWKcP2nISLaep+S3x8k vjZI+/YrrjnIwJiK1zEn622RtgLaVeZ/tC/w6JQkBKn0ebI8bAZeoH79RAic3PBL+VK5 Oyt8pib2QPv22bbiuyxC7h5hQqJT1k44wd/37Q3AExwKyVTEpVq9Sswn5WY0/RXb00gL 8/TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6tGBN+zzYbWK2jK0y5GPUjPXMJuzyUfAtlopttoVK4E=; b=imxCneR0xixTIbzEnu2oPONR8GPnF0yNWs6CQntPpyAGSJeRj/MU/d4Sz0XSpNHnEC 415O0cKuBianV1BoRHKLDqdcXdxqipEO/6XDOmwmJcDWPLRf10xFKgrXa5nwlES+IiKQ VuD6hbC1ZHMCm4fbBjttdFrKI/WAr3er2MoLW9oNpnsG00xHwCUxSAoWqpQnLDK3oZQ7 P4PLkUk0U7BXYjolIAqMSX+VcGQaF2RvW5CBenfpG5W0nu+OrnpBFfYCd3XNkZV3T62U AHAzscJeUleDzuZwRG7DzGgH3t5kIaPz3LtuT+9a0sls8qpKnnMiBoiACkNfco3LB4lP SMog== X-Gm-Message-State: AOAM533xZLQ2MamHTZXS3aiDx4ZA1TM7zg3Fb5toVGUVLD+eZdZzEzHk 19PPfUFQpqZVzTMMk9KYm7TQ5tBxTdDovQ== X-Google-Smtp-Source: ABdhPJw3sGs+km74SVMJWX9v32L377GL0CktPvhcu8PByGcZSns20hwwU+NatXrOdQCVV5dMcYpbXg== X-Received: by 2002:a63:d80f:: with SMTP id b15mr6816596pgh.388.1620571678727; Sun, 09 May 2021 07:47:58 -0700 (PDT) Received: from localhost.localdomain (KD106154103141.au-net.ne.jp. [106.154.103.141]) by smtp.gmail.com with ESMTPSA id y64sm9184190pfy.204.2021.05.09.07.47.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 May 2021 07:47:58 -0700 (PDT) From: satotake To: emacs-orgmode@gnu.org Subject: [PATCH] org-refile.el: Fix the case of emtpy buffer name Date: Sun, 9 May 2021 23:47:13 +0900 Message-Id: <20210509144712.23387-2-doublequotation@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210509144712.23387-1-doublequotation@gmail.com> References: <20210509144712.23387-1-doublequotation@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=doublequotation@gmail.com; helo=mail-pg1-x531.google.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, 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-Mailman-Approved-At: Sun, 09 May 2021 11:07:17 -0400 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: , Cc: satotake Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620572993; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: 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=6tGBN+zzYbWK2jK0y5GPUjPXMJuzyUfAtlopttoVK4E=; b=ku0xCAGmnLbWS0uavphHkVTbP9VWsp5pUryYY/LmYGzjmOFYtjt9ne5XZCmjAl4ODLWbCl mkxHZLeHnwZI/XdtlkXpPdN1u9oYRxKBItt23l694UOB10XO6h7KbH3owsb6+YVaTnjZS8 /8WC9Lf4FArGRnh2rPBVvmzYaora6u34gc8pVK8/yrjsF9zjXUqQMnShEPFVNQAU+XI2po +1KIP1GXuCxEOeOJ89bwfWet3oTGFgRq3tv/5g50AhIdVm3e1WvBQ73rJDOXKDra/6wZzx WMh1OjT0bcMRdYBQucM2UhkQWn/xZZA0R50fG0mFPn56w1gV4SEfz1Di+0EA1w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620572993; a=rsa-sha256; cv=none; b=fdHQfUnOjZlasj3aBeduJ0wrY5XH1oB/XurZl9HXeTDMAiJBkW29mqdpH1jS+JRlzRFzw2 9RsvxtFN+WrLA/W8ARlILvmlq3BDBBkhO3xybhkMwyX+glgicmVo/R/JjNA7uqXiOh5yEF obGzOHgK7SCAzhkC+k/QSwcdwfZWpz8kEquueQZrzRrGl4RYne1rpBthz1ri+LH8aWuuja gcRy2veNwzFyaIfTFPSkNgyCJ+/83kQCCyltixeJlXNQl+rtnEoukslAdpJCuEpq3d3Dst 7Cdl24tQVBd4Uue5wdLUIAbLUgKyzxPaLk7ibZBaauGa7IZUAEpHlbPIEez+fg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b="Txx4o/V2"; dmarc=pass (policy=none) header.from=gmail.com; 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-Migadu-Spam-Score: 1.85 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b="Txx4o/V2"; dmarc=pass (policy=none) header.from=gmail.com; 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-Migadu-Queue-Id: 6CB4019925 X-Spam-Score: 1.85 X-Migadu-Scanner: scn0.migadu.com X-TUID: WNkNbb/WcU5T * lisp/org-refile.el (org-refile-get-targets): Ensure arg of `file-name-non' and `file-truename' is non-nil. If you set `org-refile-use-outline-path' `file' or `full-file-path', and call `org-refile' in the buffer before visiting file, errors are raised at these point. To fix them, check if they are nil or not. TINYCHANGE --- lisp/org-refile.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/org-refile.el b/lisp/org-refile.el index 24a1bde51..6f5b8acee 100644 --- a/lisp/org-refile.el +++ b/lisp/org-refile.el @@ -310,11 +310,14 @@ converted to a headline before refiling." (setq f (buffer-file-name (buffer-base-buffer f)))) (setq f (and f (expand-file-name f))) (when (eq org-refile-use-outline-path 'file) - (push (list (file-name-nondirectory f) f nil nil) tgs)) + (push (list (if f (file-name-nondirectory f) nil) f nil nil) tgs)) (when (eq org-refile-use-outline-path 'buffer-name) (push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs)) (when (eq org-refile-use-outline-path 'full-file-path) - (push (list (file-truename (buffer-file-name (buffer-base-buffer))) f nil nil) tgs)) + (push (list (if (buffer-base-buffer) + (file-truename (buffer-file-name (buffer-base-buffer))) + nil) + f nil nil) tgs)) (org-with-wide-buffer (goto-char (point-min)) (setq org-outline-path-cache nil) @@ -337,9 +340,11 @@ converted to a headline before refiling." #'identity (append (pcase org-refile-use-outline-path - (`file (list (file-name-nondirectory - (buffer-file-name - (buffer-base-buffer))))) + (`file (list + (if (buffer-base-buffer) + (file-name-nondirectory + (buffer-file-name (buffer-base-buffer))) + nil))) (`full-file-path (list (buffer-file-name (buffer-base-buffer)))) -- 2.30.0