From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UPIoOnpunWCLCAAAgWs5BA (envelope-from ) for ; Thu, 13 May 2021 20:22:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id qLnRNXpunWBKYwAAB5/wlQ (envelope-from ) for ; Thu, 13 May 2021 18:22:50 +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 418681336E for ; Thu, 13 May 2021 20:22:50 +0200 (CEST) Received: from localhost ([::1]:44184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhFyy-0003xj-Ol for larch@yhetil.org; Thu, 13 May 2021 14:22:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhFxi-0003tm-H4 for emacs-orgmode@gnu.org; Thu, 13 May 2021 14:21:30 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:39696) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lhFxg-0000ho-Vy for emacs-orgmode@gnu.org; Thu, 13 May 2021 14:21:30 -0400 Received: by mail-pl1-x629.google.com with SMTP id t4so14852544plc.6 for ; Thu, 13 May 2021 11:21:28 -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=YFmKyXTvAND8M/nWRIPOnZSS1IP+qqkRjmuWO6Akq8E=; b=vNJmDaBgbyhpCnU6leSG30g3f9ZHUnJWi5adWCE+jRyfU7zdlccLaD8ulFr2nZ9zTa 6z91MkwCBhnUoyc4kqxHA/2QbZJUIcRcbpZTX3dd+PEe2E+o3Elumvk4x+nAM9RPQ9lM ACtamG8MexQD4J/XY6Itw9fTDvcVfR5TdvhKTaVkQgTiKq+OZKYa1VYgOHXRlbu6E5Ow KGBOrnP9HTpPrlcVc9kHvo8qjtd6Sor91ntbLW6NOAjg+Z/d2ds/DHJs9TKv6hFl8+dl xFxDmGCT/iW6DNgWhAU5+oHorcFxmrnf47+KFsy9lIvVX1pLzX0HwnYOqtfqQA+QYt+s corQ== 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=YFmKyXTvAND8M/nWRIPOnZSS1IP+qqkRjmuWO6Akq8E=; b=erXhjxpS4P1x3EwxkvyeIWNIg6QBG4bITsB3vTBsUNYl9tgd7GiUkCmdbWERqWZy6Z 6toI2/BNuEhkLEKOSq01NmZXESFAUZnQErG2ZUvO7nirQOJWtDPTkV+OLQFiTtpxFhTh BS+2f/X+EW7L8TdN/bBPnsKthvNpHVJBV9lOVWW9coA28Ruv7QrlDzSkraGHNEoFhQXO N6ABGy6Aw9Vl2/2oD9celTvqcf1fJH6GHA3NH4D4sgF64wiklC+PcE4K7mhfo1Ky3U08 2NV7B1nQIyem8tPjxyr15p1ALk1BQuifnEadl5XlUngWRPvkifSXAEIUzziTwcOmLcW5 3NSQ== X-Gm-Message-State: AOAM530SyfeHrvPz75rg3ZVQQzjFS2SkBlnFdUb21k3WR4XDV4HvpQp9 V+q8quI194nqPDXRc0TTerM= X-Google-Smtp-Source: ABdhPJxXn6itDPAA/SOm1e+lhcs/xWiJqstGJ52bqiZI2wlUNa30pl+YDQLzVTaYMeHl83pfqCRe5w== X-Received: by 2002:a17:902:9002:b029:e6:c95f:2a1d with SMTP id a2-20020a1709029002b02900e6c95f2a1dmr41911961plp.79.1620930087460; Thu, 13 May 2021 11:21:27 -0700 (PDT) Received: from localhost.localdomain (KD106154111012.au-net.ne.jp. [106.154.111.12]) by smtp.gmail.com with ESMTPSA id s3sm2516440pfu.9.2021.05.13.11.21.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 May 2021 11:21:27 -0700 (PDT) From: satotake To: manikulin@gmail.com Subject: [PATCH] org-refile.el: Fix the case of emtpy buffer name Date: Fri, 14 May 2021 03:20:52 +0900 Message-Id: <20210513182052.2798-2-doublequotation@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210513182052.2798-1-doublequotation@gmail.com> References: <20210513182052.2798-1-doublequotation@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=doublequotation@gmail.com; helo=mail-pl1-x629.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-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 , emacs-orgmode@gnu.org 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=1620930170; 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=YFmKyXTvAND8M/nWRIPOnZSS1IP+qqkRjmuWO6Akq8E=; b=UX9c6CJKQVtQOJApyBgktSZ/Y1Y/512kxI/xkVVri13gixUSqm+7a8moU59csyBKpY0rFv /8cXunLkJK58uvvh0oOZpCBgMDeubfz9TgOcdIuq6ZM2mpFNCdxbeEspChrm230+0VJcBV suH6ROJo5hH5dA8eVPpKvDWyNp5WX/hxI3TsfOGYHZIgTUEWjwgwJtCtiMZs59UEs3xb0D lK+WO60PlODqTEUGuHISyaO5fGOmIqyYO5pkSiXYnPgvJtjJYne41thkDvMT8FVvfPPCMw 6SZOhTgcbwBaGU4k0U+GY5q9fkH3z77ImWsS3MYqML8qK6vY8MUsSZioDbQmUA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620930170; a=rsa-sha256; cv=none; b=mOrw9/Vfq2N5f7M034l+EWi8lGEalmxnYZn46b8PzL4MdqASHi+NWCVLmppj8pOpl6rafb O8+4LC4G3rCukTNp0pPzj1ZXDITK8qZ5/g8YdPq7E7b6h/ZeCMqPoYK56TkZsmPcNfRgf4 R1olImnMXSOOmzb99HN1RuygQl6iK97W5C2kPCsi3Shpop+I4l5MKlpC+CsltqgeGYngBC V3P3rxpabPF18CJpH6gFHq3cAubT/WRdcRyf+ejs+0XweflAKDo9tfuq03H9jWjTFOJmNc 2QDNWx32rmTmbSAHYRYvuQexVb3SIKZOolJWzUMiJA4PHsyuKsE/U0/qcAIOjQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=vNJmDaBg; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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-Migadu-Spam-Score: 3.65 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=vNJmDaBg; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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-Migadu-Queue-Id: 418681336E X-Spam-Score: 3.65 X-Migadu-Scanner: scn0.migadu.com X-TUID: lR+jcxtQOXu2 * 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 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lisp/org-refile.el b/lisp/org-refile.el index 24a1bde51..2900be27e 100644 --- a/lisp/org-refile.el +++ b/lisp/org-refile.el @@ -310,11 +310,13 @@ 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 (and f (file-name-nondirectory f)) 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 (and (buffer-file-name (buffer-base-buffer)) + (file-truename (buffer-file-name (buffer-base-buffer)))) + f nil nil) tgs)) (org-with-wide-buffer (goto-char (point-min)) (setq org-outline-path-cache nil) @@ -337,9 +339,10 @@ 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 + (and (buffer-file-name (buffer-base-buffer)) + (file-name-nondirectory + (buffer-file-name (buffer-base-buffer)))))) (`full-file-path (list (buffer-file-name (buffer-base-buffer)))) -- 2.30.0