From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 kBmBOdHwKWMp8wAAbAwnHQ (envelope-from ) for ; Tue, 20 Sep 2022 18:56:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id eFKNOdHwKWNuFwEA9RJhRA (envelope-from ) for ; Tue, 20 Sep 2022 18:56:49 +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 9FBD41DC80 for ; Tue, 20 Sep 2022 18:56:49 +0200 (CEST) Received: from localhost ([::1]:47752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oagYB-0003Wd-SK for larch@yhetil.org; Tue, 20 Sep 2022 12:56:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oad6e-0004OD-0b for emacs-orgmode@gnu.org; Tue, 20 Sep 2022 09:16:11 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:38761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oad6Z-0001pV-Qp for emacs-orgmode@gnu.org; Tue, 20 Sep 2022 09:16:06 -0400 Received: by mail-pg1-x52f.google.com with SMTP id t70so2577036pgc.5 for ; Tue, 20 Sep 2022 06:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date; bh=tjRPadTKbj130505Zodu1Ocu5PoxQ+YBzHxOwIIR/wA=; b=CpEf02uzwA/mVlXIYH3mAFdH9nLiCCxYIR9UZQ9p93CLoQG03TEAv3bWDGlyLUGqZv LAKoh3BIHIYT8c1g2leA7CbedpQkQsRY2P3+LXvCbe8tpLhz7+SPP7nw/ZROZv/PxhVA I35bBeVI07R937MAAX6ZbIkBBUZlUDkAwWsPzX72aJ7ma6Roo0V7zhA0EaaFxuE1vwh+ lcl89UeUiow4+5i/mE6t/4L2NqH/GzkCYml/pbZ01lVceopM4Pjhxj+1vvDhwgWmgS+z QxE7Tv27TRSQFDCUvuWsdV/lp6QE1VjlDl5q4t5ZfKMIcUP8xqsRY/jWYjmonJ1OyEEr fCWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=tjRPadTKbj130505Zodu1Ocu5PoxQ+YBzHxOwIIR/wA=; b=i0o/0blssMZVV0IGKSfQx7siGG3SuC+F+rVuLDLdmLQKhLmU9srkjA49mPbCz5ttB7 VA+dJahsv+jafLYt6qTO1FHE4gOfvvTmRkq4cXNvEcADvQTqYMdjVGBFvg6OwUjInDNu GXX/oL+L8JVmBOwvQxRfSNOODCpCp/oFuqi9YpwLzHjS3WMchcysjknYm2yJSNGovNNg HBWumI8db4nNiqNqptP3qPE7xDhZGjpGcoC+rW3bbaZ09QOQellFAaui1iNm435jk+Kk EMhRe2hnmGl9gowWP3QR1c//gmUri9gxmjCKiDUPHtXm28Byfg7XVI4mPp0HBL5bp5Q5 PZrw== X-Gm-Message-State: ACrzQf1sbcNfpT9bQIF2NKrBqxzyb5pcr+x3ARtrUEL7JNiLBGq4DOrz SJKIca9r+ofsIhDOszNsX8Q= X-Google-Smtp-Source: AMsMyM4AxQNYMYqmXY73+UdcDWOEZ/OeMwfe7RBOJKqKVwV5wXN3MsYmfcHGVFHxJ8IFPErj0ff8yw== X-Received: by 2002:a63:6cc7:0:b0:42b:7d8f:7136 with SMTP id h190-20020a636cc7000000b0042b7d8f7136mr20016817pgc.15.1663679761728; Tue, 20 Sep 2022 06:16:01 -0700 (PDT) Received: from localhost ([2409:8a70:2b5:ad00:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id 207-20020a6214d8000000b0053dfef91b0bsm1649578pfu.205.2022.09.20.06.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 06:16:00 -0700 (PDT) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] [BUG] org.el: Fix first call of `org-paste-subtree' In-Reply-To: References: Date: Tue, 20 Sep 2022 21:16:55 +0800 Message-ID: <87illiyym0.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=yantar92@gmail.com; helo=mail-pg1-x52f.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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.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" 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=1663693009; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=tjRPadTKbj130505Zodu1Ocu5PoxQ+YBzHxOwIIR/wA=; b=elO0uNa1bChdw805sYXfB9fMUVnPQLLUVIbNgOV4+xDhe9YrjjC36ZsErZX61CmZKepn27 koQXAzYhIOVfGhsDd7Xl5tqQgqWQMVDbVZ23pWt5bGx4OIA1Dt3XhahHSINyIpve6uSwje LJeMR3qJPgjKC5Bk57ZcO9BN19FLuciraUEImF/TDkyhJHxy9wwCnkwlXO+CDjHXDCb06n keryDIhQxvytZvnvukHNd0E7PSMF8VqgwKuIsLw+wWo5SBzcTaUnq2vPiDxbVx5HuUNLiJ 36yP3qMcKuodkbUapvYEBbsZ+hvot7p+QPH4fjqk81lKk1DYXn3HCYTALZ0frg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663693009; a=rsa-sha256; cv=none; b=kZa3FYDEBMiP+mLhZqbxJBROfAZ0rN7YpdwCJ7UyI4FhJVVqcp5s69+ru+GQgDQ4v4Zvbf quHJGpnzPun+KWgpi4fi8HWk1KNtZEXeQhH7nD/izZzhtaGE3RRY8eNDkKXGXopR62/lVb 5NuLlK+buDjfZBJG1Rpbgt7Se/dnHNBXmN1UPWk6oHn5FwXz6S5+89bdqSXBXOODLCT2XK XUUCOCAHy/OKhLlVIwjqb7FXLSa0fV6p/8zTpbU8VXKrG0jdUmU1Teum2sxLULPqz/owpe EndGyVQDAaCCIpTrsE6a30jeOCdBePKUQyEsNdfx8DqMgpitmb/dVXuQSlpO/A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CpEf02uz; dmarc=pass (policy=none) header.from=gmail.com; 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: -1.83 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CpEf02uz; dmarc=pass (policy=none) header.from=gmail.com; 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: 9FBD41DC80 X-Spam-Score: -1.83 X-Migadu-Scanner: scn1.migadu.com X-TUID: 3pmaqsy9jcby Max Nikulin writes: > When REMOVE is non-nil, remove the subtree from the clipboard." > (interactive "P") > - (setq tree (or tree (and kill-ring (current-kill 0)))) > + (setq tree (or tree (current-kill 0))) > (unless (org-kill-is-subtree-p tree) The main problem the old code solves is working around user error when kill-ring is empty. We do not really want to err in such cases; just handle empty kill ring specially. I agree that (and kill-ring ...) condition misses the system clipboard. The proper way to handle this issue is explicitly catching "Kill ring is empty" error thrown by `current-kill' (i.e. `condition-case'). We have 3 occurrences of (and kill-ring (current-kill 0)) constructs in the code and may fix the problem either by replacing each instance with `condition-case' or we may create a separate macro/function in org-macs and use it. -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92