Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun duplicate-start-of-line-or-region ()
- (interactive)
- (if mark-active
- (duplicate-region)
- (duplicate-start-of-line)))
- (defun duplicate-start-of-line ()
- (let ((text (buffer-substring (point)
- (progn (beginning-of-line) (point)))))
- (if (eq (progn (end-of-line) (point)) (point-max))
- (newline)
- (forward-line))
- (push-mark)
- (insert text)
- (open-line 1)))
- (defun duplicate-region ()
- (let* ((end (region-end))
- (text (buffer-substring (region-beginning)
- end)))
- (goto-char end)
- (insert text)
- (push-mark end)
- (setq deactivate-mark nil)
- (exchange-point-and-mark)))
Add Comment
Please, Sign In to add comment