From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gLlLOVP2FmFoFwEAgWs5BA (envelope-from ) for ; Sat, 14 Aug 2021 00:46:43 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 2CfuNFP2FmG7LwAAB5/wlQ (envelope-from ) for ; Fri, 13 Aug 2021 22:46:43 +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 755E1279E4 for ; Sat, 14 Aug 2021 00:46:43 +0200 (CEST) Received: from localhost ([::1]:57758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mEfwo-0005UN-GF for larch@yhetil.org; Fri, 13 Aug 2021 18:46:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEfwG-0005PP-9t for emacs-orgmode@gnu.org; Fri, 13 Aug 2021 18:46:08 -0400 Received: from mout01.posteo.de ([185.67.36.65]:34051) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEfwB-0006uB-SW for emacs-orgmode@gnu.org; Fri, 13 Aug 2021 18:46:08 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 69535240026 for ; Sat, 14 Aug 2021 00:46:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1628894761; bh=2y22Wt+3/ISDp79H9F64vN+EPez2g/n8ht60C4txcCU=; h=From:To:Cc:Subject:Date:From; b=fSQxFgiHl1GSMcVUxEAJrhyGXw78C8TGZWVB297HwLBOTg0mWVJfpnlIj+bizBIUq YwN4vylKYcS0rxX1g6HvblthqH481kG+ZnmQHBzoyBpNAN+MQO906UB9XwUNsfheu+ MsWePeDOjOwvxoSeFg+lG+C2xAztXdunfyvJVRjMsmuG3vCfq8uUz/NcW7KqXXqKza 7lftU1wstEX2b954K5XUJKW8Lbs2VKwFLgL9SgFYI5JceIIokl2jnZy2mik5WG+t7U W+jIAIsxfxFRCy++vRSkuyvJQVi2eeO/2ouTfI9ZuOBL9Qm4imkFeZOzJb321GqXT7 aM3mxglS/eWLg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GmdvD623sz9rxG; Sat, 14 Aug 2021 00:46:00 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Rodrigo Morales Subject: Re: Custom function for killing the thing at point References: <87im095682.fsf@gmail.com> Date: Fri, 13 Aug 2021 22:46:00 +0000 In-Reply-To: <87im095682.fsf@gmail.com> (Rodrigo Morales's message of "Fri, 13 Aug 2021 17:29:17 -0500") Message-ID: <877dgp6k0n.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=maciaschain@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, 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: orgmode 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=1628894803; 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=Sz7idlwI+0OHPIepWcke1ajS3SlNs06Mp78oHrQ4PVM=; b=W9Qtp276Zh5/GH12Kc3o1A0vtKZVqL0BKU12XORTclxTpMnnZYqOIa480/Z3oAhTAc3QZj Lk0KIgKgeCEmGFoOZw/yJo0JlKs1WWVsq0895+4Pdvnyz4zAoJPlVEM0Y+OxDeQNFMbZcH BAmyNIuLKsDnUhFSFRXgS8EUAGafGlM8tReOdl+y3QH/Cbpf52cSu4/hzUPHpdUnTQgE2O SF6F95gEzi8DfH7fiXXXf6XDUqq5NO3cjZweARXbAvGnFwr8tRLeZ6qv0sWoNO+PUqKv4k ansllg+c/vz+Ir9VnA04ihTAI1BbV/T4+KiGJ7SgPb6dVA975vkSID/P9eciUQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628894803; a=rsa-sha256; cv=none; b=ffQ30w37ANRh8yNH0hVH5+/CxaESE62yW7R5Cfpp5VILy3Zp3V/T7dtUCRMqjWW1buy17p a3sFFVYx0TqEj2zKllaPnp2nkF4k1EJTVmaavynfTmH+LYZ8mXO0VLGaiaxCl0JyipaeYk 4CwAmy1hRdKR3XqdV3ahdsjGQq9uHUqfxYOW5WVHfWrKj9pn7rSEYkn6/asZE7S1V1OrsM WYYssOILFZ2Uyl3+tZ5kZPYzxYB6RpVPA9az5pjDk1Hr+1VFKCqt2Kkb13GpOGOZQwVi5e jX486aIl6FddraDnaRkGRnzs+5wFuOjXIftIvTdKhgbKcqgJU0mAmacBZWqkbA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=fSQxFgiH; 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.11 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=fSQxFgiH; dmarc=pass (policy=none) header.from=posteo.net; 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: 755E1279E4 X-Spam-Score: -3.11 X-Migadu-Scanner: scn1.migadu.com X-TUID: XqJxTYxL9kpR Hi Rodrigo, Thanks for sharing, it seems interesting and useful. But I think this function is missing in your post: `my/kill-new'. Best regards, Juan Manuel Rodrigo Morales writes: > I just created this function for copying the thing under the cursor (it > works for some #+BEGIN blocks and links). I think it would be useful for > others, so I'm creating this post for getting feedback on the Elisp code > and sharing it to those interested. > > #+BEGIN_SRC elisp > (defun my/org-kill-thing-at-point () > "Kill the thing at point. > > The following things are currently supported > > - #+BEGIN_SRC <> > - #+BEGIN_EXPORT <> > - #+BEGIN_EXAMPLE <> > - #+BEGIN_COMMENT > - Org links (the description is not copied)" > (interactive) > (let* (content > (element (org-element-context)) > (type (org-element-type element))) > (cond ((or (eq type 'src-block) > (eq type 'export-block) > (eq type 'example-block) > (eq type 'comment-block)) > (setq content (plist-get (cadr element) :value))) > ((eq type 'link) > (setq content (plist-get (cadr element) :raw-link))) > (t > (error "The element at point couldn't be copied."))) > (my/kill-new content))) > #+END_SRC > > #+BEGIN_SRC elisp > (define-key org-mode-map (kbd "C-c c") 'my/org-kill-thing-at-point) > #+END_SRC >