-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Populate the buffer with the current contents of the textarea #64
Comments
Hi @awkspace, There is no option for automating this use case via the package. We've had discussions about this use case in the past and decided that selecting, copying, and pasting was preferable to automation because it gives the user more control over how text is edited, but If you can think of a clever way of providing this feature in such a way that the hook function(s) have a say in whether or not to select and copy the text to the buffer, then I'd be open to adding this feature to the package. The path of least resistance for your purposes might be to just wrap the shell script from this package with a tiny script of your own to do the select and copy steps. Then, paste to your Emacs buffer using the hook function. |
I thought I might just contribute my approach here. I also run into the situation where I want to over-write some text, and populate emacs-anywhere with it. I do this by selecting the text, which if you want to do in say a textbox is of course as easy as (if (x-selection-exists-p 'PRIMARY)
(insert (x-selection))) When exiting emacs, via default OS behaviour, the selection is overwritten 🎉. |
not sure if its' because I'm on OSX but your idea @tecosaur doesn't work for me. I've tried: (insert (gui-selection-value))
(insert (gui-get-selection 'PRIMARY))
(insert (x-get-selection 'PRIMARY)) even with the (when (gui-get-primary-selection)
(insert (gui-get-selection 'PRIMARY))) it doesn't work, my doom-emacs closes the window immediately, not sure why apparently the call to |
@d1egoaz I went through a few iterations after that initial comment, I now have (when (gui-get-selection 'PRIMARY)
(insert (gui-get-selection 'PRIMARY))) Which works for me. I'm on linux though so... |
yeah, it doesn't work for OSX 😞 |
I've got another iteration of this to make up for (defun ea-popup-handler (app-name window-title x y w h)
;; other stuff here
(when (gui-get-selection 'PRIMARY) (insert (gui-get-selection 'PRIMARY)))
(set-transient-map (let ((keymap (make-sparse-keymap)))
(define-key keymap (kbd "DEL") (lambda! (delete-region (point-min) (point-max))))
(define-key keymap (kbd "C-SPC") (lambda! (delete-region (point-min) (point-max))))
keymap))) Press DEL or C-SPC immidiately after pulling up EmacsAnywhere and it will clear the buffer. You can find my complete config for EA here if it's of any use to anyone, |
This project is awesome for writing new text, but I'd like to be able to edit text that's already present. Right now I just copy/paste it into Emacs when invoking emacs-anywhere, but I was wondering if this was possible to get automated?
The text was updated successfully, but these errors were encountered: