diff options
author | Taylor R Campbell <campbell+paredit@mumble.net> | 2022-08-28 21:18:04 +0000 |
---|---|---|
committer | Taylor R Campbell <campbell+paredit@mumble.net> | 2022-08-28 21:30:35 +0000 |
commit | 52be50188ef8c49d8c1a5ef71cb0a963c6a05f09 (patch) | |
tree | 10351a887b08074e52ed6599a899c9ef6fe93e78 /paredit.el | |
parent | e4a67f4f23ba936b4bdc8d7e66bd8c6729064558 (diff) |
paredit-raise-sexp: Handle active mark in transient mark mode.
Diffstat (limited to 'paredit.el')
-rw-r--r-- | paredit.el | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -2158,17 +2158,22 @@ If the point is on an S-expression, such as a string or a symbol, not between them, that S-expression is considered to follow the point." (interactive "P") (save-excursion - (cond ((paredit-in-string-p) - (goto-char (car (paredit-string-start+end-points)))) - ((paredit-in-char-p) - (backward-sexp)) - ((paredit-in-comment-p) - (error "No S-expression to raise in comment."))) ;; Select the S-expressions we want to raise in a buffer substring. - (let* ((n (prefix-numeric-value argument)) - (bound (scan-sexps (point) n)) + (let* ((bound + (if (and (not argument) (paredit-region-active-p)) + (progn (if (< (mark) (point)) + (paredit-check-region (mark) (point)) + (paredit-check-region (point) (mark))) + (mark)) + (cond ((paredit-in-string-p) + (goto-char (car (paredit-string-start+end-points)))) + ((paredit-in-char-p) + (backward-sexp)) + ((paredit-in-comment-p) + (error "No S-expression to raise in comment."))) + (scan-sexps (point) (prefix-numeric-value argument)))) (sexps - (if (< n 0) + (if (< bound (point)) (buffer-substring bound (paredit-point-at-sexp-end)) (buffer-substring (paredit-point-at-sexp-start) bound)))) ;; Move up to the list we're raising those S-expressions out of and |