New answers tagged


This can be done by advising the function that sets the clipboard. ;; Clipboard history. (defvar my-clipboard-history-limit 10) (defvar my-clipboard-history--list nil) (defun my-clipboard-history-paste (&optional index) (insert (nth (or index 0) my-clipboard-history--list))) (defun my-clipboard-history-paste-penultimate () (interactive) (my-...


You're in luck; this is already built in. C-y yanks the last thing that you've killed or copied, and M-y replaces it with the next item from the kill-ring, which contains everything you've killed or copied in your current Emacs session.


The function (defun my-line-save () (interactive) (let ((l(substring (thing-at-point 'line)0 -1))) (kill-new l) (message "saved : %s" l))) can do the trick, just assign the keys of your choice (local-set-key (kbd "C-c w") #'my-line-save) or whatever keys you like.


C-a C-SPC C-e M-w does work in all versions of Emacs. The only reason it doesn't work for you is that you've changed the key bindings. If you're using a GUI Emacs, you can use home S-end C-insert or Home S-End M-w instead. This may or may not work in a terminal, depending on how the terminal passes function keys to Emacs. I'm can't use C-a because this ...

Top 50 recent answers are included