As in Emacs 23.2, you can set save-interprogram-paste-before-kill to non-nil (tip tip Tyler ) to copy the clipboard selection to the kill ring, so that it is accessible via Cy My :
(setq save-interprogram-paste-before-kill t)
If you are in older Emacs, the following tip has the same functionality:
(defadvice kill-new (before kill-new-push-xselection-on-kill-ring activate) "Before putting new kill onto the kill-ring, add the clipboard/external selection to the kill ring" (let ((have-paste (and interprogram-paste-function (funcall interprogram-paste-function)))) (when have-paste (push have-paste kill-ring))))
And you can do something like this (terrible key binding, adjust according) to remove the line from the point forward:
(define-key minibuffer-local-map (kbd "CSd") 'delete-line) (defun delete-line (&optional arg) (interactive "P") ;; taken from kill-line (delete-region (point) ;; It is better to move point to the other end of the kill ;; before killing. That way, in a read-only buffer, point ;; moves across the text that is copied to the kill ring. ;; The choice has no effect on undo now that undo records ;; the value of point from before the command was run. (progn (if arg (forward-visible-line (prefix-numeric-value arg)) (if (eobp) (signal 'end-of-buffer nil)) (let ((end (save-excursion (end-of-visible-line) (point)))) (if (or (save-excursion ;; If trailing whitespace is visible, ;; don't treat it as nothing. (unless show-trailing-whitespace (skip-chars-forward " \t" end)) (= (point) end)) (and kill-whole-line (bolp))) (forward-visible-line 1) (goto-char end)))) (point))))
source share