1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00
Commit graph

17 commits

Author SHA1 Message Date
Robert Pluim
587efce9fa Autodetect coding system when yanking media
Some browers send eg 'text/html' selections formatted as UTF-8, but
with a type of STRING, which actually means iso-latin-1.  Autodetect
the correct coding system to use by calling 'gui-get-selection'.

* lisp/yank-media.el (yank-media--get-selection): Call
'gui-get-selection' instead of 'gui-backend-get-selection'.
2023-07-13 15:37:16 +02:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Lars Ingebrigtsen
224aeb2877 Fix yank-media utf-16 detection
* lisp/yank-media.el (yank-media--utf-16-p): Factor out into its
own function for easier testing and fix the code.
2022-02-05 08:50:05 +01:00
Lars Ingebrigtsen
e51f904676 Fix yank-media-types--format decoding
* lisp/yank-media.el (yank-media-types--format): Check that we
really have some nuls.
2022-02-05 07:01:00 +01:00
Eli Zaretskii
823b6b8d26 ; Add 2022 to copyright years. 2022-01-01 07:07:15 -05:00
Lars Ingebrigtsen
e96e6a1ba5 Allow yank-media-types to also show the unsupported data types
* lisp/yank-media.el (yank-media-types): Make the prefix include
data types not supported by the backend, too.
2021-11-09 04:41:14 +01:00
Lars Ingebrigtsen
41b1fa05c7 Switch yank-media--get-selection back to the backend function
* lisp/yank-media.el (yank-media--get-selection): Switch back to
gui-backend-get-selection until gui-get-selection is re-fixed.
2021-11-08 12:27:01 +01:00
Lars Ingebrigtsen
19f37afe27 Fix yank-media--get-selection thinko in previous change
* lisp/yank-media.el (yank-media--get-selection): Fix thinko after
previous change.
2021-11-08 06:03:41 +01:00
Lars Ingebrigtsen
0022b02d16 Clean up the yank-media data massaging
* lisp/yank-media.el (yank-media--get-selection): Put the
nul-massaging code...
(yank-media-types--format): ... here instead, and decode utf-16
better.
2021-11-08 05:54:10 +01:00
Lars Ingebrigtsen
4287e94c30 Add a new debugging/exploration command `yank-media-types'
* lisp/yank-media.el (yank-media-types): New command.
(yank-media-types--format): Helper command.
2021-11-08 05:44:10 +01:00
Lars Ingebrigtsen
cddd927d36 Rename 'register-yank-media-handler'
* lisp/textmodes/sgml-mode.el (html-mode):
* lisp/gnus/message.el (message-mode):
* doc/lispref/frames.texi (Yanking Media): Adjust.
* lisp/yank-media.el (yank-media): Adjust doc string.
(yank-media-handler): Rename from `register-' because that may
cause confusion with register.el functions.
2021-11-08 01:40:58 +01:00
Lars Ingebrigtsen
3dae236eb2 Fix charset issues in text/html yanking
* lisp/yank-media.el (yank-media--get-selection): Use
gui-backend-get-selection instead of the higher-level function
which guesses wrong on the charset on many types.
(yank-media): Fix the case where there's only one match.
2021-11-08 01:15:06 +01:00
Lars Ingebrigtsen
9d54b1222c Expand register-yank-media-handler doc string
* lisp/yank-media.el (register-yank-media-handler): Expand doc string.
2021-11-07 00:24:13 +01:00
Lars Ingebrigtsen
cadf325575 Fix yank-media logic when there's several handlers
* lisp/yank-media.el (yank-media): Fix logic when there's several
different handler functions.
2021-11-07 00:18:02 +01:00
Lars Ingebrigtsen
14a5ad139c Fix typo in previous yank-media--get-selection change
* lisp/yank-media.el (yank-media--get-selection): Fix typo in
previous change.
2021-11-06 22:44:31 +01:00
Lars Ingebrigtsen
973f0aa559 Fix nul-terminated text/* strings from some programs
* lisp/yank-media.el (yank-media--get-selection): Some programs
nul-terminate text/* strings.  Fix that.
2021-11-06 22:43:22 +01:00
Lars Ingebrigtsen
48ca3c99c8 Add a framework for yanking media into Emacs
* doc/emacs/killing.texi (Clipboard): Refer to it.
* doc/lispref/frames.texi (Yanking Media): Document the mechanism.

* lisp/yank-media.el: New file.

* lisp/gnus/message.el (message-mode): Register a yank handler for
images.
(message-insert-screenshot): Factor out image code from here...
(message--yank-media-image-handler): ... to here.
2021-11-06 21:59:27 +01:00