[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/paredit 2f3db5f 021/224: Broaden `paredit-raise-sexp' to a
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/paredit 2f3db5f 021/224: Broaden `paredit-raise-sexp' to act sensibly on strings and characters. |
Date: |
Sat, 7 Aug 2021 09:22:10 -0400 (EDT) |
branch: elpa/paredit
commit 2f3db5fb243c4c13b4340f21714ec2865ec7feb0
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>
Broaden `paredit-raise-sexp' to act sensibly on strings and characters.
darcs-hash:20080928142541-00fcc-90dd4da3c4fd9e689c7d1558f384f21766f07e86
---
paredit.el | 44 ++++++++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 18 deletions(-)
diff --git a/paredit.el b/paredit.el
index 284d8fe..63a19d3 100644
--- a/paredit.el
+++ b/paredit.el
@@ -1678,25 +1678,33 @@ With a prefix argument N, kill only the following N
S-expressions."
(defun paredit-raise-sexp (&optional n)
"Raise the following S-expression in a tree, deleting its siblings.
With a prefix argument N, raise the following N S-expressions. If N
- is negative, raise the preceding N S-expressions."
+ is negative, raise the preceding N S-expressions.
+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")
- (paredit-lose-if-not-in-sexp 'paredit-raise-sexp)
- ;; Select the S-expressions we want to raise in a buffer substring.
- (let* ((bound (save-excursion (forward-sexp n) (point)))
- (sexps (if (and n (< n 0))
- (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
- ;; delete it.
- (backward-up-list)
- (delete-region (point) (save-excursion (forward-sexp) (point)))
- (save-excursion (insert sexps)) ; Insert & reindent the sexps.
- (save-excursion (let ((n (abs (or n 1))))
- (while (> n 0)
- (paredit-forward-and-indent)
- (setq n (1- n)))))))
+ (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* ((bound (save-excursion (forward-sexp n) (point)))
+ (sexps (if (and n (< n 0))
+ (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
+ ;; delete it.
+ (backward-up-list)
+ (delete-region (point) (save-excursion (forward-sexp) (point)))
+ (save-excursion (insert sexps)) ; Insert & reindent the sexps.
+ (save-excursion (let ((n (abs (or n 1))))
+ (while (> n 0)
+ (paredit-forward-and-indent)
+ (setq n (1- n))))))))
(defun paredit-convolute-sexp (&optional n)
"Convolute S-expressions.
- [nongnu] elpa/paredit e80ffcc 112/224: Check for expected errors in `paredit-backward-delete'., (continued)
- [nongnu] elpa/paredit e80ffcc 112/224: Check for expected errors in `paredit-backward-delete'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 3bf30f9 115/224: Omit redundant `paredit-backward-delete' test., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit ba0de55 120/224: Add brief docstring to `paredit-check-region-state'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 951813a 131/224: Fix `paredit-move-past-close' within a character escape., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 901acb8 012/224: Changes for version 16., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 602e328 011/224: Changes for version 15., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 760ae70 004/224: Changes for version 8., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 004d257 013/224: Changes for version 17., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 7f89e54 014/224: Changes for version 18., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 17852a0 019/224: Call `comment-forward' as a symbol with `funcall'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 2f3db5f 021/224: Broaden `paredit-raise-sexp' to act sensibly on strings and characters.,
ELPA Syncer <=
- [nongnu] elpa/paredit 8ab1694 022/224: Change `paredit-comment-on-line-p' to use `comment-search-forward'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit e121b92 024/224: Clarify `paredit-insert-comment' and change its criteria for code comments., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 451ea5e 025/224: Add magic autoload comment for `paredit-mode'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit a386bdf 031/224: Call `end-of-defun' in `paredit-reindent-defun'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 0d7a39d 032/224: Un-deprecate `enable-paredit-mode' and `disable-paredit-mode'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit db3a581 037/224: Switch copying terms to GPLv3+., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit ab99e93 044/224: Simplify definition of `paredit-kill-line-in-string'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 5bfc873 047/224: Fix `paredit-copy-as-kill' within strings., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit d265584 045/224: Fix `paredit-kill' on whitespace character literal with margin comment., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 7b31864 046/224: Check `eolp' before using `char-after' in `paredit-kill'., ELPA Syncer, 2021/08/07