Context:
I have been using an interesting software called Emacs Anywhere. It helps me bring emacs keybindings for stuff like this (editing text for a question on Stack Exchange). Overall, the software has been working well!
This is an illustration of the expected behavior:
- I put my cursor on a text box from Stack Overflow to write a question.
- Then, I invoke Emacs Anywhere with a hotkey
- Cool, I am editing text now with Emacs
- After finishing what I want to ask on SO, I press
C-x 5 0
, the frame is deleted, and the text written on the Emacs frame is inserted on the text box my cursor was pointing to on the browser. Cool! I believe in magic :)
The main problem I have is when I change the cursor on the browser before the text is inserted. For instance:
- I put my cursor on a text box from Stack Overflow to write a question.
- Then, I invoke Emacs Anywhere with a hotkey
- Cool, I am editing text now with Emacs
- As I am writing text, I decide to check Wikipedia and official documentation to base my answer, I left my pointer in a selected text from Wikipedia
- Now, I am back to the Emacs frame editing my question
- After finishing what I want to ask on SO, I press
C-x 5 0
and the frame is deleted. Unfortunately, the test I wrote is not introduced to text box of SO. Why? Because the cursor on the browser is not on the same page and point of the browser it was when I started the process!
Oh, boy. After written a big question, I wished I had saved it. I am sure yank-pop
could save me!
Hence, I have the idea: maybe I should write something on my config file to add the content of a frame to the clipboard ring (or kill ring) before a frame is deleted!
Question
So, I would like to define a hook so that every time I delete an Emacs frame (default keybinding C-x 5 0
), the content happens to be added to the kill ring (clipboard ring) before the real deletion happens.
How would you do it?