Advertisement
Guest User

Untitled

a guest
Sep 10th, 2017
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.06 KB | None | 0 0
  1. (defun yf-kill-new-second-pos (string)
  2.   "Make STRING the second kill in kill ring. Mainly to
  3. be used in order to redo all of the evil delete commands
  4. such that they don't overwrite what is in the system clipboard,
  5. but are still accessable by `helm-show-kill-ring' and similar commands.
  6.  
  7. Obviously therefore given the intended use of this function, unlike `kill-new'
  8. it does not worry about whether or not interprogram paste is set or not,
  9. and always acts like it is not.
  10.  
  11. It also does not change the `kill-ring-yank-pointer', as it is expected that the
  12. paste system clipboard buffer is still intended to be what the user wants
  13. to yank.
  14.  
  15. Much of the code here is borrowed from `kill-new' in simple.el"
  16.  
  17.   ;; start stuff that is ripped straight from kill-new
  18.   (unless (and kill-do-not-save-duplicates
  19.            ;; cadr instead of car
  20.            (equal-including-properties string (cadr kill-ring)))
  21.     (setcdr kill-ring (cons string (cdr kill-ring)))
  22.     (if (> (length kill-ring) kill-ring-max)
  23.     (set-cdr (nthcdr (1- kill-ring-max) kill-ring) kill-ring) nil)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement