-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* lispy.el (lispy--oneline): Update. * lispy-test.el (lispy-oneline): Add test.
- Loading branch information
Showing
2 changed files
with
25 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
;; Author: Oleh Krehel <[email protected]> | ||
;; URL: https://github.com/abo-abo/lispy | ||
;; Version: 0.23.0 | ||
;; Version: 0.26.0 | ||
;; Keywords: lisp | ||
|
||
;; This file is not part of GNU Emacs | ||
|
@@ -2456,25 +2456,27 @@ When the sexp is top-level, insert an additional newline." | |
"Remove newlines from EXPR. | ||
When IGNORE-COMMENTS is not nil, don't remove comments. | ||
Instead keep them, with a newline after each comment." | ||
(lispy-mapcan-tree | ||
(lambda (x y) | ||
(cond ((equal x '(ly-raw newline)) | ||
y) | ||
((lispy--raw-comment-p x) | ||
(if (null ignore-comments) | ||
(progn | ||
(push x lispy--oneline-comments) | ||
y) | ||
(if (equal (car y) '(ly-raw newline)) | ||
(cons x y) | ||
`(,x (ly-raw newline) ,@y)))) | ||
((and (lispy--raw-string-p x) | ||
(null ignore-comments)) | ||
(cons `(ly-raw string ,(replace-regexp-in-string "\n" "\\\\n" (caddr x))) | ||
y)) | ||
(t | ||
(cons x y)))) | ||
expr)) | ||
(if (vectorp expr) | ||
(apply #'vector (lispy--oneline (mapcar #'identity expr))) | ||
(lispy-mapcan-tree | ||
(lambda (x y) | ||
(cond ((equal x '(ly-raw newline)) | ||
y) | ||
((lispy--raw-comment-p x) | ||
(if (null ignore-comments) | ||
(progn | ||
(push x lispy--oneline-comments) | ||
y) | ||
(if (equal (car y) '(ly-raw newline)) | ||
(cons x y) | ||
`(,x (ly-raw newline) ,@y)))) | ||
((and (lispy--raw-string-p x) | ||
(null ignore-comments)) | ||
(cons `(ly-raw string ,(replace-regexp-in-string "\n" "\\\\n" (caddr x))) | ||
y)) | ||
(t | ||
(cons x y)))) | ||
expr))) | ||
|
||
(defun lispy-oneline () | ||
"Squeeze current sexp into one line. | ||
|