emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] [BUG] org.el: Fix first call of `org-paste-subtree'


From: Ihor Radchenko
Subject: Re: [PATCH] [BUG] org.el: Fix first call of `org-paste-subtree'
Date: Tue, 20 Sep 2022 21:16:55 +0800

Max Nikulin <manikulin@gmail.com> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]