diff options
| -rw-r--r-- | paredit.el | 23 | 
1 files changed, 23 insertions, 0 deletions
| @@ -1461,6 +1461,29 @@ With a numeric prefix argument N, do `kill-line' that many times."  ;;                              nil nil parse-state)           )          (t parse-state))) + +(defun paredit-copy-as-kill () +  "Save in the kill ring the region that `paredit-kill' would kill." +  (interactive) +  (save-excursion +    (if (paredit-in-char-p) +        (backward-char 2)) +    (let ((beginning (point)) +          (eol (point-at-eol))) +      (let ((end-of-list-p (paredit-forward-sexps-to-kill beginning eol))) +        (if end-of-list-p (progn (up-list) (backward-char))) +        (copy-region-as-kill beginning +                             (cond (kill-whole-line +                                    (or (save-excursion +                                          (paredit-skip-whitespace t) +                                          (and (not (eq (char-after) ?\; )) +                                               (point))) +                                        (point-at-eol))) +                                   ((and (not end-of-list-p) +                                         (eq (point-at-eol) eol)) +                                    eol) +                                   (t +                                    (point))))))))  ;;;; Cursor and Screen Movement | 
