emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Gerardo Moro <gerardomoro37@gmail.com>
To: Tim Visher <tim.visher@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Possibility to copy text outside EMACS and send it to orgmode document
Date: Wed, 6 Jan 2021 22:46:10 +0200	[thread overview]
Message-ID: <CAF4Fj9jswVet3pGVy=LuDf5iNFpQiPrnnj+UHLyM5ca30yaZQQ@mail.gmail.com> (raw)
In-Reply-To: <CAHa53uw3oF-7pXK-5j-zxMMNoezvke58ZyQ9=JE3jK4xgLcsLA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2618 bytes --]

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é, 6 ene 2021 a las 17:56, Tim Visher (<tim.visher@gmail.com>)
escribió:

> On Wed, Jan 6, 2021 at 1:43 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 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`:
>
> ```
> …
> 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.
>

[-- Attachment #2: Type: text/html, Size: 3676 bytes --]

  parent reply	other threads:[~2021-01-06 20:47 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-28 16:59 Remembrance Agents Gerardo Moro
2020-11-28 17:08 ` George Mauer
2020-11-28 18:26 ` Jean Louis
2020-11-29 13:07   ` Gerardo Moro
2020-11-29 13:52     ` Eric S Fraga
2020-11-29 17:29       ` Jean Louis
2020-11-29 17:47         ` Eric S Fraga
2020-11-30 11:15           ` Jean Louis
2021-01-06  6:41             ` Possibility to copy text outside EMACS and send it to orgmode document Gerardo Moro
2021-01-06  6:48               ` Samuel Wales
2021-01-06  6:49               ` Tom Gillespie
2021-01-06  6:58                 ` Gerardo Moro
2021-01-07  5:14                   ` Ihor Radchenko
2021-01-07  5:36                     ` Gerardo Moro
2021-01-07  6:17                       ` Tom Gillespie
2021-01-07  6:29                         ` Gerardo Moro
2021-01-07  7:54                           ` Ihor Radchenko
2021-01-09 17:32                           ` TRS-80
2021-01-06 15:56               ` Tim Visher
2021-01-06 17:42                 ` Bob Newell
2021-01-06 20:46                 ` Gerardo Moro [this message]
2021-01-06 16:14               ` Maxim Nikulin
2021-01-06 16:31               ` Juan Manuel Macías
2020-11-30  6:48       ` Remembrance Agents Gerardo Moro
2020-11-30  9:31         ` Eric S Fraga
2020-11-30  9:37           ` Gerardo Moro
2020-11-30 10:09             ` Eric S Fraga
2020-11-30 10:35               ` Jean Louis
2020-11-30 10:18           ` Jean Louis
2020-11-30 10:16         ` Jean Louis
2020-11-30 11:16           ` Gerardo Moro
2020-11-30 11:25             ` Jean Louis
2020-11-29 17:15     ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAF4Fj9jswVet3pGVy=LuDf5iNFpQiPrnnj+UHLyM5ca30yaZQQ@mail.gmail.com' \
    --to=gerardomoro37@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tim.visher@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).