From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id KEHLBzve9V/EJQAA0tVLHw (envelope-from ) for ; Wed, 06 Jan 2021 15:58:51 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id TJSyAzve9V/+KAAAB5/wlQ (envelope-from ) for ; Wed, 06 Jan 2021 15:58:51 +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 AF95E9404E1 for ; Wed, 6 Jan 2021 15:58:50 +0000 (UTC) Received: from localhost ([::1]:45116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxBCz-0003IO-K9 for larch@yhetil.org; Wed, 06 Jan 2021 10:58:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxBAz-0002SR-FB for emacs-orgmode@gnu.org; Wed, 06 Jan 2021 10:56:45 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:54426) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxBAx-0006p1-NZ for emacs-orgmode@gnu.org; Wed, 06 Jan 2021 10:56:45 -0500 Received: by mail-wm1-x32e.google.com with SMTP id c133so2803216wme.4 for ; Wed, 06 Jan 2021 07:56:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CKKip0ytnkcHyp0V6gtA2CDQPDeBNxLeR7aOQZlsG44=; b=nBTJha2i0F+1SPk754GT/xJtRSBPzvdEmO1o0gozyZ0skI9GJLNemmuWlFimy85qAY U9IbsNqqhtU7Mfot45Zb5r4yGwjx12CyonfTPyfCrRNgowrsJ3ddeYgafRJc5PC4gBdG w4IzIHSdZyYQ629K8tJ1rTjxo/PiVfYLEotWo2lUBOdfAfKh2NksRpzfW/6HS80y9zcE vrOC3YyBAKMyBKLFWHi+OWbTnx57YoSc5JskF120geN/PVwUjg+FuGPBGajfJxNwSS+f xBS91Cy5eFwzlSNElRtaveGD2Kz7EXyxWzStOrulwaoUP/8NQrgDzcVCyfo0GQNahgXK MYng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CKKip0ytnkcHyp0V6gtA2CDQPDeBNxLeR7aOQZlsG44=; b=eZ9dlzyDlJpoLGYzPYOLJt7xKbCO6uMj6lRqBSmhyuf5uLS3d9Bhyep3jIRrS+nFpV JVpzgnuUQ6oNP9EBuKD+oEfWWEsCvKrD0pD/Jm50yBGiwvYU/30hxzW+ocESs7w/yF2X JL1uuON6PQMNrWnVLpntJNl9UOjb4P1zw24dk52V5NlyF5jycd6lIL3xewJFpxIS6XpT +xYMz86JGHYk/ODhcFVhXihsa2FiViVz5nHoQIIp48pEij6fFKhT/mSTYFEY0eZWdNrH j3YbDrXd4O4RuaPEsysd5PLxYJ+1s8HZqNJ46SQmzCEe1N6LXeSDPTG5gBZEUYklNLAn 26kw== X-Gm-Message-State: AOAM532hYW2OSYBVoIZcVy9+JhYdBSZxEIZggE8oQYbud7qP88gPkniB Xisqq9xok2cycwVZWx9xe2VsqGqaHn5Xxny80vk= X-Google-Smtp-Source: ABdhPJw3VPkJ6EaxcYNEegE03ZrfTp2ul5XJZ1ENmzeP8BtFrgBHbFu03vzguvmaOabJV2HbaGAEXelvNlViBTClIYw= X-Received: by 2002:a7b:cbd0:: with SMTP id n16mr4299893wmi.162.1609948601571; Wed, 06 Jan 2021 07:56:41 -0800 (PST) MIME-Version: 1.0 References: <87eekcfeyk.fsf@ucl.ac.uk> <87wny4oy0h.fsf@ucl.ac.uk> In-Reply-To: From: Tim Visher Date: Wed, 6 Jan 2021 10:56:05 -0500 Message-ID: Subject: Re: Possibility to copy text outside EMACS and send it to orgmode document To: Gerardo Moro Content-Type: multipart/alternative; boundary="00000000000080dcbd05b83d5e2c" Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=tim.visher@gmail.com; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, HTML_MESSAGE=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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.04 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=nBTJha2i; dmarc=pass (policy=none) header.from=gmail.com; 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: AF95E9404E1 X-Spam-Score: -3.04 X-Migadu-Scanner: scn0.migadu.com X-TUID: vJeKCIloAIhW --00000000000080dcbd05b83d5e2c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 6, 2021 at 1:43 AM Gerardo Moro wrote= : > Basically that: as I copy (Control-C) text from the browser (Chrome), I > would like those copied sentences to be sent to a ordered list in an > OrgMode document: > > - copied text 1 > - copied text 2 > - etc. > > Any ideas? This would be very useful. > On macOS I've done _similar_ things to this (albeit not exactly what you're asking) by simply generating org text for me to paste in. For instance I have an applescript `org-current-tab`: ``` =E2=80=A6 on org_current_tab() tell application "Google Chrome" set the_title to title of active tab of front window set the_title to my replace_chars(the_title, "[", " ") set the_title to my replace_chars(the_title, "]", " ") return "[[" & URL of active tab of front window & "][" & the_title & "]]" as text end tell end org_current_tab ``` Then from anywhere I can activate this applescript and all I need to do is whack `C-y` in emacs and I get the link pasted in. It's not hard then to extend this directly into emacs via the `osascript` executable: ``` (defun org-current-tab () (interactive) (unless (eq major-mode 'org-mode) (user-error "This command must be triggered in an org buffer.")) (let* ((output (with-temp-buffer (call-process "osascript" nil t nil "-e" "tell application \"Finder\" to set current_tab_handlers to (load script file \"current_tab_handlers.scpt\" of folder \"Dropbox\" of home as alias)" "-e" "tell current_tab_handlers to org_current_tab()") (substring-no-properties (thing-at-point 'line t) 0 -1)))) (insert output))) ``` I'm not sure what environment you're in so you may not have access to a system's scripting tool like Applescript but depending on the scripting facilities of whatever you're targeting maybe you can get most of the way there. At the worst you could add whatever text you want to your clipboard and then write some elisp that processes it before writing it to your org buffer. --00000000000080dcbd05b83d5e2c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Jan 6, 2021 at 1:43 AM Gerardo Mo= ro <gerardomoro37@gmail.com> wrote:

On= macOS I've done _similar_=C2=A0 things to this (albeit not exactly wha= t you're asking) by simply generating org text for me to paste in.

For instance I have an applescript `org-current-tab`:<= /div>

```
=E2=80=A6
on org_current_tab()
=C2=A0 =C2=A0 tell application "Google Chrom= e"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 set the_title to title of active tab= of front window
=C2=A0 =C2=A0 =C2=A0 =C2=A0 set the_title to my replace= _chars(the_title, "[", " ")
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 set the_title to my replace_chars(the_title, "]", " &quo= t;)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return "[[" & URL of activ= e tab of front window & "][" & the_title & "]]&q= uot; as text
=C2=A0 =C2=A0 end tell
end org_current_tab

```=

Then from anywhere I can activate this apples= cript and all I need to do is whack `C-y` in emacs and I get the link paste= d in.

It's not hard then to extend this direct= ly into emacs via the `osascript` executable:

```<= br>(defun org-current-tab
=C2=A0 =C2=A0 ()
= =C2=A0 (interactive)
=C2=A0 (unless (eq major-mode 'org-mode)
=C2= =A0 =C2=A0 (user-error "This command must be triggered in an org buffe= r."))
=C2=A0 (let* ((output (with-temp-buffer
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(call-process
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "osasc= ript" nil t nil
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 "-e" "tell application \"Finder\&q= uot; to set current_tab_handlers to (load script file \"current_tab_ha= ndlers.scpt\" of folder \"Dropbox\" of home as alias)"<= br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &q= uot;-e" "tell current_tab_handlers to org_current_tab()")=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(subs= tring-no-properties (thing-at-point 'line t) 0 -1))))
=C2=A0 =C2=A0 = (insert output)))

```

I'm not su= re what environment you're in so you may not have access to a system= 9;s scripting tool like Applescript but depending on the scripting faciliti= es of whatever you're targeting maybe you can get most of the way there= . At the worst you could add whatever text you want to your clipboard and t= hen write some elisp that processes it before writing it to your org buffer= .
--00000000000080dcbd05b83d5e2c--