From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: Cut and paste an entry programmatically Date: Sat, 29 Jun 2019 09:27:48 +0200 Message-ID: References: <87lfxlky1z.fsf@kyleam.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:44186) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hh7qd-0001Rh-Eu for emacs-orgmode@gnu.org; Sat, 29 Jun 2019 03:32:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hh7qc-0004oM-Hz for emacs-orgmode@gnu.org; Sat, 29 Jun 2019 03:32:35 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]:45580) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hh7qc-0004m9-3b for emacs-orgmode@gnu.org; Sat, 29 Jun 2019 03:32:34 -0400 Received: by mail-lf1-x12a.google.com with SMTP id u10so5382486lfm.12 for ; Sat, 29 Jun 2019 00:32:32 -0700 (PDT) In-Reply-To: <87lfxlky1z.fsf@kyleam.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Kyle Meyer Cc: Org Mode Hi Kyle On Sat, Jun 29, 2019 at 2:58 AM Kyle Meyer wrote: > Hmm I don't consider that a bug. It's documented behavior for kill > commands to append to the last kill when called successively. > > ,----[ C-h f kill-region RET ] > | [...] > | Any command that calls this function is a "kill command". > | If the previous command was also a kill command, > | the text killed this time appends to the text killed last time > | to make one entry in the kill ring. > | [...] > `---- Although I knew of course that ~C-k C-k~ appends it didn't ring the bell it should have. And I was not aware of the concept of a "kill command" which can make my function a "kill command", _depending on how it is invoked_. > In addition to what Samuel posted, another way for a lisp caller to > avoid the append behavior if desired is to let-bind this-command so that > kill-region's attempt to set it to kill-region doesn't work. Using your > example, that'd be > > #+begin_src emacs-lisp > (defun temp () > (let (this-command) > (org-cut-subtree)) > (org-forward-heading-same-level 2) > (org-paste-subtree)) > #+end_src This is what I have been looking for, thank you. Michael