From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id SKkmBs8h9l9FNgAA0tVLHw (envelope-from ) for ; Wed, 06 Jan 2021 20:47:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id KAbkAc8h9l/aFwAAbx9fmQ (envelope-from ) for ; Wed, 06 Jan 2021 20:47:11 +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 4E0349403CD for ; Wed, 6 Jan 2021 20:47:10 +0000 (UTC) Received: from localhost ([::1]:36914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxFhx-0003qQ-99 for larch@yhetil.org; Wed, 06 Jan 2021 15:47:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxFhL-0003qG-N5 for emacs-orgmode@gnu.org; Wed, 06 Jan 2021 15:46:27 -0500 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]:44423) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxFhJ-0003gr-Ir for emacs-orgmode@gnu.org; Wed, 06 Jan 2021 15:46:27 -0500 Received: by mail-lf1-x12a.google.com with SMTP id m25so9514624lfc.11 for ; Wed, 06 Jan 2021 12:46:23 -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=2VfCVxPGiLKz7SorpTVdAULffE+PTUVFPe9/wrv6YfE=; b=Z+EJGTZPavG17S9Dv+sEXbnAp7K9TNti9OYNb+ASWysPk97ovKicAN4ex0XavSVjYY Ijh2GHNhEpnMitar+IL1KKZiuHUWxHokU49PzKon1DtScxHzgAJwDOv66PQNvBjepUV8 mc0HT3LxWRNavSdfBMN8kVW4MDAQAjwThCqhzMyXn9SW28zafGuzC89Uqk6eig2ERTKE CVajGEOy4sf5qP15RCWa1YTTubWL8I8ui9f/XBA0T59ZMygF8BwJYIi8XoXmDv8jX3BE 33MXJ2e/oHrkHxxkNLPJ+upNoMx6Qu2hFjosCUbb653Fiqrry8poA67y41hYdX2hQIPY kuiA== 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=2VfCVxPGiLKz7SorpTVdAULffE+PTUVFPe9/wrv6YfE=; b=PH5D9Gsj2QJmOF+p0TtgTb7vOjAJyLhfwCC9DmRAakbQNttFNESfJIgLH6vDeuCsW+ RPJFNZOin4oXkWMmOzPb3I4/ZfoKLbXhLKTK49uS7E0CCYRdg8gMh5J/f1aCFX5vY+s1 2q9GF3K5/MW+EPzsRkyPoIRh7eq/hIfe/kxumWKyb8cOgpfcrLsn9B40XL8gwtl08BZY qexoSs5fNbFuGcKTa7zNNecNjfkZAPXXZJvkbeD3W8KMJzHUZhEHfLGcv5dpSCl2az8p Ksmzvciv3rmdEadlC7Qxfx8IcYTE3wZw4h9hfUO5fU9Xwk1jyF/IgmKUR9pOcznih/cW 9uAg== X-Gm-Message-State: AOAM5307k/jbWU5kby8Jt8ddHSSD22C2bn6gNYiKx4nnspS3XCj5t+FE YKWXskZHqer5uYLMbaE7wfev/9SBmcwESz/IL2U= X-Google-Smtp-Source: ABdhPJz61ZhDmvz3ls96buFDSN6pKayU6UccNPUwfgbRUS325u0QLdx5AXEhc7qwAs810xbW9xNf4y4fzDDkQQtipw0= X-Received: by 2002:a19:c001:: with SMTP id q1mr2489868lff.55.1609965981766; Wed, 06 Jan 2021 12:46:21 -0800 (PST) MIME-Version: 1.0 References: <87eekcfeyk.fsf@ucl.ac.uk> <87wny4oy0h.fsf@ucl.ac.uk> In-Reply-To: From: Gerardo Moro Date: Wed, 6 Jan 2021 22:46:10 +0200 Message-ID: Subject: Re: Possibility to copy text outside EMACS and send it to orgmode document To: Tim Visher Content-Type: multipart/alternative; boundary="0000000000007197cf05b8416a67" Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=gerardomoro37@gmail.com; helo=mail-lf1-x12a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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=Z+EJGTZP; 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: 4E0349403CD X-Spam-Score: -3.04 X-Migadu-Scanner: scn0.migadu.com X-TUID: aEZGFq9G9XH7 --0000000000007197cf05b8416a67 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This is very cool, thanks, and I very much use Automator. I will have a look later, but it seems that you have to move focus to Emacs, so it does not directly send something to a orgmode document straight from the copy action in the browser. El mi=C3=A9, 6 ene 2021 a las 17:56, Tim Visher () escribi=C3=B3: > 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_titl= e > & "]]" as text > end tell > end org_current_tab > ``` > > Then from anywhere I can activate this applescript and all I need to do i= s > 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\" o= f > 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 clipboar= d > and then write some elisp that processes it before writing it to your org > buffer. > --0000000000007197cf05b8416a67 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This is very cool, thanks, and I very much use Automator.<= div>I will have a look later, but it seems that you have to move focus to E= macs, so it does not directly send something to a orgmode document straight= from the copy action in the browser.

El mi=C3=A9, 6 ene 2021 a las 17= :56, Tim Visher (<tim.visher@gma= il.com>) escribi=C3=B3:
On Wed, Jan 6, 2021 at 1:4= 3 AM Gerardo Moro <gerardomoro37@gmail.com> wrote:
=
Basically that: as I copy (Control-C) text from = the browser (Chrome), I would like those copied sentences to be sent to a o= rdered 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_=C2=A0 thing= s to this (albeit not exactly what you're asking) by simply generating = org text for me to paste in.

For instance I have a= n applescript `org-current-tab`:

```
=E2= =80=A6
on org_current_tab()
=C2=A0 =C2=A0 te= ll application "Google Chrome"
=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, "[", " &= quot;)
=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 return= "[[" & URL of active tab of front window & "]["= ; & the_title & "]]" as text
=C2=A0 =C2=A0 end tellend org_current_tab

```

Then from a= nywhere 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 n= ot hard then to extend this directly into emacs via the `osascript` executa= ble:

```
(defun org-cu= rrent-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 buffer."))
=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 "osascript" nil t nil
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "-e" "t= ell application \"Finder\" to set current_tab_handlers to (load s= cript file \"current_tab_handlers.scpt\" of folder \"Dropbox= \" of home as alias)"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "-e" "tell current_tab_handl= ers to org_current_tab()")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(substring-no-properties (thing-at-point = 9;line t) 0 -1))))
=C2=A0 =C2=A0 (insert output)))

```

I'm not sure what environment you're in so yo= u may not have access to a system's scripting tool like Applescript but= depending on the scripting facilities of whatever you're targeting may= be you can get most of the way there. At the worst you could add whatever t= ext you want to your clipboard and then write some elisp that processes it = before writing it to your org buffer.
--0000000000007197cf05b8416a67--