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 OL5QJ4E5KmOVTQEAbAwnHQ (envelope-from ) for ; Wed, 21 Sep 2022 00:06:57 +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 QCUPJ4E5KmP8sAAAauVa8A (envelope-from ) for ; Wed, 21 Sep 2022 00:06:57 +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 7556A28BBA for ; Wed, 21 Sep 2022 00:06:56 +0200 (CEST) Received: from localhost ([::1]:42006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oal7M-00035i-5K for larch@yhetil.org; Tue, 20 Sep 2022 17:49:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oagmm-0006XJ-5M for emacs-orgmode@gnu.org; Tue, 20 Sep 2022 13:11:52 -0400 Received: from ciao.gmane.io ([116.202.254.214]:46262) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oagmk-0008Td-KE for emacs-orgmode@gnu.org; Tue, 20 Sep 2022 13:11:51 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1oagmh-0008ZQ-KH for emacs-orgmode@gnu.org; Tue, 20 Sep 2022 19:11:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Max Nikulin Subject: Re: [PATCH] [BUG] org.el: Fix first call of `org-paste-subtree' Date: Wed, 21 Sep 2022 00:11:41 +0700 Message-ID: References: <87illiyym0.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US In-Reply-To: <87illiyym0.fsf@localhost> Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 6 X-Spam_score: 0.6 X-Spam_bar: / X-Spam_report: (0.6 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-2.182, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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=1663711616; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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; bh=pyV1ftxv8x+FRBzILdImC1O8YkPozjYUFqbfn/MVJ4A=; b=j7iv7Rk0SlJhQcnRkpaxm0mnzxgQYyEEY6IxN8dOUNiQvl4v1VaQDLSaQK+S4aZjgMa/LO PtYxXB/dBUKqnN+4zeR8CuTc9nWpj5T0X8P+TF/6Kdqd+f+xLkbhxQw8THgfOJ8nBnZ7aB Zck4MXLH2o+4fQJqctZ3++yIFBhPqmgT9XUZOXshUSrmOOJqDJRpBr1Avo3tal7vV4nYDs mQHTjLS7kIKCjJS6E2S//F/qgaXOBaiv9MtBZfUtgKR+nL6Kmhv3zfoELOek5EzRX4bTGz 94YOdBZB3v9+zfAeaaLLJWwac48nBRJ8Yj43rqshlU6tuuWewM8RXD4eMQnKOA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663711616; a=rsa-sha256; cv=none; b=YbJ3FCPuNa9CnYUdbJi8XwMlHACljYsLJg8qAVXw5haIXvw91HX1VOxAK/PlLIW9+2z9mP VSds+RjBqqJrm8vtW4+dUixFGvsTP8fK2msD3DJPg9m2qmzddZZ5+23evM2ptDGEsob/Gh C7hqf+bLkpMMtnvpoFf8zhAo7K8fxB4HZXC+FZw2Ix9l0MtmFdHa/1xZywBfPbiL4kXCgR +kAtxj+sUNXNaa0maWYMml6uOGlXM2//HNu27Afj93wv7YhfnWj1RWhVe/kA13KKQSN8L4 GCk55+K8D1uupMxo0m1LmQjaaTnS1ugE4mx8MQPclGotc+bcEaACG0g2PEqLmQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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: 4.37 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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: 7556A28BBA X-Spam-Score: 4.37 X-Migadu-Scanner: scn1.migadu.com X-TUID: XflBGug8uE1L On 20/09/2022 20:16, Ihor Radchenko wrote: > 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. From my point of view "kill ring is empty" user error clearly describes what happens in such case, so I do not see any point to spit suggestion to try simple yank instead. > 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'). Why do you believe that just allowing to propagate this error is worse? > 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. Other cases (such as the one at the end of `org-paste-subtree' to determine if yanked text should be folded) require more care.