|
From: | Max Nikulin |
Subject: | Re: idea for capture anywhere in x |
Date: | Tue, 11 Oct 2022 00:16:55 +0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 |
On 10/10/2022 00:08, Jean Louis wrote:
* Max Nikulin [2022-10-09 19:41]:On 09/10/2022 21:47, Jean Louis wrote:File: ~/bin/capture-x-selection.sh #!/usr/bin/bash TEMP=/tmp/xselection.txt xsel -o > $TEMP(perhaps unsafe) intermediate file is redundant. Emacs can access text/plain target of PRIMARY_SELECTION and CLIPBOARD directlyDirectly of courseworks, but that would mean that you have to make several clicks, not just one click. It also implies you must have Emacs in front of you, and not sitting around as server in background or anywhere.
Jean, make a pause and think ones more. It does not mean extra click and implies nothing different from you recipe.
Years ago I was taught to the following approach: when you came to a solution, look at it and try to figure out if it is possible to achieve the same in a shorter and more clear way.
If `yank' command can get selection contents then you can do the same in your function and avoid problems with intermediate files.
In Org it can be achieved with a simple capture template (even org-protocol is not necessary), but you prefer your own solution having enough limitations.
If Emacs had generic enough functions to create captures then Org would reuse it as it extends outline mode. Maybe such tools should be added to Emacs, but they should be designed at first.
The idea of org-protocol is to pass more data.It is structured data, something like '(:url "https://www.example.com" :title "Something" :body "More here") and it may be anything in general. But no, I don't find it appealing in itself apart from using those ready made browser extensions.
A browser extension is a straightforward way to add page URL to the quoted text.
In fact when we speak of capturing any selection from X, I would not like relying on Emacs, it would be better using SQLite or PostgreSQL for that.
Plain text files stored in a version control system allows to review changes done at specific time interval. Databases require a non-trivial layer to allow reverting of particular changes. So a database is not better, it is *different* use case.
[Prev in Thread] | Current Thread | [Next in Thread] |