emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: idea for capture anywhere in x


From: Maxim Nikulin
Subject: Re: idea for capture anywhere in x
Date: Wed, 9 Sep 2020 11:52:31 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

09.09.2020 05:40, Samuel Wales wrote:
On 9/7/20, Maxim Nikulin <manikulin@gmail.com> wrote:
Do you mean a tiny tool that takes content of X primary selection or
clipboard and passes it to emacs-client org-protocol argument?

maybe.  guessing probably.  i want it to take contents of x primary
selection or clipboard and get it into emacs using a capture template
item.  whether this requries oprg-protocl, idk.

Isn't Tim's suggestion suitable for you (to call emacsclient --eval '(org-capture)' directly without any additional tool or even org-protocol)? I noticed his answer after I sent my message.

Some wrapper to create a new frame may be necessary, but since you are likely happy with your desktop protocol handler, you could use very similar script with eval instead of org-protocol argument when emacsclient is invoked.

Capture templates allow calling of arbitrary lisp code, so you could take value from kill ring or call low level gui-get-selection function. The latter would allow separate templates for primary selection and for clipboard.

I do not know what is more convenient for you, to use emacs capture template dialog or dedicated menu items or hotkeys in window manager for access to primary selection and clipboard and passing additional argument to org-capture.

By the way, is there a convention for keystrokes that allows both clipboard and primary selection? I have seen that either option could be configured for default kill/yank but sometimes it is convenient to use both.

The harder part is extracting of formatted text (that could be
application specific) and converting it to org markup. I had a look
into emacs sources and did not find extension points to obtain
application-specific format, so external tool could provide some benefit
(e.g. capturing link with description from libreoffice).

while such features would be great, my needs are modest i think.  i
would be delighted with just plain text.

but if possible i'd want it to be inserted as utf-8 even if the
terminal or deluge or whatever uses some different encoding.

With spread of UTF-8 I almost forget problems with charsets. I hope, currently it should be workarounds for particular applications.

I have seen comments that modern pandoc could convert various formats to org. As to working with formatted text, previous time my curiosity was exhausted after the following commands for tcl

package require Tk
puts "[selection get -type TARGETS]"
puts "[selection get -type text/html -selection CLIPBOARD]

I have not searched which languages provide easy access to selection with minimal dependencies and if there are some ready to use libraries to extract rich text. Maybe sources of a browser or an office application should be expected (or of some simple application that still allows to copy-paste of rich text).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]