diff options
| author | Taylor R Campbell <campbell@mumble.net> | 2009-02-23 06:50:27 +0000 | 
|---|---|---|
| committer | Taylor R Campbell <campbell@mumble.net> | 2009-02-23 06:50:27 +0000 | 
| commit | 43bf81fec70052b0be37109e27f76e968bb982e8 (patch) | |
| tree | 61cdeb8cf14f38066e62e43e75f8b6a7cdd5ba8c | |
| parent | f7c26b9336361c368dfdaae278da3838d2879bc7 (diff) | |
Implement `paredit-copy-as-kill'.
Saves to the kill ring the text of the region that `paredit-kill'
would kill.  Suggested by Norman Werner <norman@norman-werner.de>.
darcs-hash:20090223065027-00fcc-7cea5cd78e291f0e86450edc70665e0e26e36a40
| -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 | 
