From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id OGFRH7FfWF8JHwAA0tVLHw (envelope-from ) for ; Wed, 09 Sep 2020 04:53:05 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id GAhWG7FfWF9deAAA1q6Kng (envelope-from ) for ; Wed, 09 Sep 2020 04:53:05 +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 0B2E49404CA for ; Wed, 9 Sep 2020 04:53:05 +0000 (UTC) Received: from localhost ([::1]:36378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFs6S-0006w1-2T for larch@yhetil.org; Wed, 09 Sep 2020 00:53:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFs69-0006vd-4C for emacs-orgmode@gnu.org; Wed, 09 Sep 2020 00:52:45 -0400 Received: from static.214.254.202.116.clients.your-server.de ([116.202.254.214]:60328 helo=ciao.gmane.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFs67-0005lm-NN for emacs-orgmode@gnu.org; Wed, 09 Sep 2020 00:52:44 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1kFs62-0008zj-TZ for emacs-orgmode@gnu.org; Wed, 09 Sep 2020 06:52:38 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Maxim Nikulin Subject: Re: idea for capture anywhere in x Date: Wed, 9 Sep 2020 11:52:31 +0700 Message-ID: References: <87sgbsq2t5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/09 00:52:39 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-1.626, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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-Spam-Score: -0.41 X-TUID: XcAJuoAs/Rx1 09.09.2020 05:40, Samuel Wales wrote: > On 9/7/20, Maxim Nikulin 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).