emacs/var/elfeed/db/data/aa/aa3c977bab31aa49784a57b066432ef1f83eb90c
2022-01-03 12:49:32 -06:00

13 lines
3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p><a class="cimage" href="https://lars.ingebrigtsen.no/wp-content/uploads/2021/11/2021-11-08.png"><img alt="" class="alignnone size-full wp-image-87365" height="389" src="https://lars.ingebrigtsen.no/wp-content/uploads/2021/11/2021-11-08.png" width="580" /></a></p>
<p>Emacs isnt really a tool for creating WYSIWYG documents, so the editing support for anything other than plain text (and code) is pretty basic.</p>
<p>As I noted <a href="https://lars.ingebrigtsen.no/2018/10/06/the-mysteries-of-the-selection/">a few years back</a>, Emacs has the primitives needed to interact with non-text clipboard types, so adding code to (say) allow choosing “Copy Image” in a browser and then pasting it into a buffer would be trivial.</p>
<p>But then what? Now you have an image in your buffer — but what do you do with it? For yanking media to be useful, the Emacs mode has to be able to do something meaningful with it.</p>
<p>For instance, a mail mode could put it into an attachment (or inline it) — so thats meaningful. The HTML mode could allow pasting both HTML and images into the mode — it could use the HTML from the browser as is, and it could offer to save the image to a local file and then insert an &lt;img&gt; pointing to it.</p>
<p>Org mode could probably also do something with the data?</p>
<p>And so on. So Ive now added a general infrastructure to Emacs 29 to allow this: Modes that feel that they can do something useful with non-plain-text selections can register themselves as such (and say which types they can handle), and then theres a new M-x yank-media command the user can use.</p>
<p>(This doesnt work on all systems yet — basically it works the ones that traditionally use X. Emacs on Windows hasnt implemented all the necessary plumbing yet (but it seems like it shouldnt take much), and its probably more work to be done on Macos. But Linux, the BSDs and similar should work fine now, and the rest show support it eventually.)</p>
<p>Watch! With amazement as I copy an image from Firefox and yank it into a mail buffer:</p>
<p><video controls="controls" loop="loop"><source src="https://lars.ingebrigtsen.no/wp-content/uploads/2021/11/media.mp4" type="video/mp4" /></video></p>
<p>Behold! With astonishment as I copy some text from Firefox into html-mode and I get HTML there:</p>
<p><video controls="controls" loop="loop"><source src="https://lars.ingebrigtsen.no/wp-content/uploads/2021/11/html.mp4" type="video/mp4" /></video></p>
<p>So… this is something that Emacs should have grown about three decades ago, but <img alt="🇺🇲" class="wp-smiley" src="https://s.w.org/images/core/emoji/13.1.0/72x72/1f1fa-1f1f2.png" style="height: 1em;" />! <img alt="🇺🇲" class="wp-smiley" src="https://s.w.org/images/core/emoji/13.1.0/72x72/1f1fa-1f1f2.png" style="height: 1em;" />! <img alt="🇺🇲" class="wp-smiley" src="https://s.w.org/images/core/emoji/13.1.0/72x72/1f1fa-1f1f2.png" style="height: 1em;" />! <img alt="🎆" class="wp-smiley" src="https://s.w.org/images/core/emoji/13.1.0/72x72/1f386.png" style="height: 1em;" /></p>