tutorial source program para mac how descargar code emacs elisp

program - emacs source code



Cómo copiar al portapapeles en Emacs Lisp (4)

El comando para colocar su selección en el portapapeles del sistema de ventanas es x-select-text . Puedes darle un bloque de texto para recordar. Así que a (buffer-substring (point) (mark)) o algo debería darle lo que necesita para pasarle. En la respuesta de Joe, puede ver la función interprogram-cut-function. Mire eso para saber cómo encontrar esto.

Quiero copiar una cadena al portapapeles (no una región de un buffer en particular, solo una cadena simple). Sería bueno si también se añadiera al kill-ring. Aquí hay un ejemplo:

(copy-to-clipboard "Hello World")

¿Esta función existe? Si es así, ¿cómo se llama y cómo lo encontraste? ¿También hay una función de paste-from-clipboard ?

Parece que no puedo encontrar esto en el Manual de referencia de Lisp, así que por favor dígame cómo lo encontró.


Hago esto:

(with-temp-buffer (insert "Hello World") (clipboard-kill-region (point-min) (point-max)))

Eso lo pone en el portapapeles. Si lo quieres en el kill-ring, agrega una forma de kill-region también.


En mi archivo .emacs, uso esto

(global-set-key "/C-V" ''yank) (global-set-key "/C-cc" ''kill-ring-save)

No pude usar Ctrl-C (o System-copy), pero esto puede ser suficiente en caso de que entren viejos hábitos.


Estás buscando kill-new .

kill-new is a compiled Lisp function in `simple.el''. (kill-new string &optional replace yank-handler) Make string the latest kill in the kill ring. Set `kill-ring-yank-pointer'' to point to it. If `interprogram-cut-function'' is non-nil, apply it to string. Optional second argument replace non-nil means that string will replace the front of the kill ring, rather than being added to the list. Optional third arguments yank-handler controls how the string is later inserted into a buffer; see `insert-for-yank'' for details. When a yank handler is specified, string must be non-empty (the yank handler, if non-nil, is stored as a `yank-handler'' text property on string). When the yank handler has a non-nil PARAM element, the original string argument is not used by `insert-for-yank''. However, since Lisp code may access and use elements from the kill ring directly, the string argument should still be a "useful" string for such uses.