- (let ((keep_pos (point))) ; We sort of cheat: We kill the line, then we
- (kill-whole-line) ; paste it back, and return point to its
- (plomvi-paste-backward) ; original position.
- (goto-char keep_pos))) ;
+ (cond
+ ((and (boundp 'rectangle-mark-mode) (eq t rectangle-mark-mode))
+ (copy-rectangle-as-kill (region-beginning) (region-end)))
+ ((use-region-p)
+ (let* ((start-start-pos (region-beginning))
+ (start-end-pos (region-end))
+ (region-start (progn
+ (goto-char start-start-pos)
+ (beginning-of-line)
+ (point)))
+ (region-end (progn
+ (goto-char start-end-pos)
+ (end-of-line)
+ (+ 1 (point)))))
+ (copy-region-as-kill region-start region-end)
+ (goto-char region-start)))
+ (t
+ (let ((keep-pos (point))
+ (region-start (progn (beginning-of-line) (point)))
+ (region-end (progn (end-of-line) (+ 1 (point)))))
+ (copy-region-as-kill region-start region-end)
+ (goto-char keep-pos)))))