@@ -2196,10 +2196,12 @@ before fixing whitespace."
2196
2196
(delete-trailing-whitespace (car sexp) (cdr sexp)))))
2197
2197
2198
2198
;;;### autoload
2199
- (defun clojure-unwind ()
2200
- " Unwind thread at point or above point by one level.
2201
- Return nil if there are no more levels to unwind."
2202
- (interactive )
2199
+ (defun clojure-unwind (&optional n )
2200
+ " Unwind thread at point or above point by N levels.
2201
+ With universal argument \\ [universal-argument], fully unwind thread."
2202
+ (interactive " P" )
2203
+ (setq n (cond ((equal n '(4 )) 999 )
2204
+ (n) (1 )))
2203
2205
(save-excursion
2204
2206
(let ((limit (save-excursion
2205
2207
(beginning-of-defun )
@@ -2208,23 +2210,24 @@ Return nil if there are no more levels to unwind."
2208
2210
(when (looking-at " (" )
2209
2211
(forward-char 1 )
2210
2212
(forward-sexp 1 )))
2211
- (search-backward-regexp " ([^-]*->" limit)
2212
- (if (clojure--nothing-more-to-unwind)
2213
- (progn (clojure--pop-out-of-threading)
2214
- (clojure--fix-sexp-whitespace)
2215
- nil )
2216
- (down-list )
2217
- (prog1 (cond
2218
- ((looking-at " [^-]*->\\ _>" ) (clojure--unwind-first))
2219
- ((looking-at " [^-]*->>\\ _>" ) (clojure--unwind-last)))
2220
- (clojure--fix-sexp-whitespace 'move-out ))
2221
- t ))))
2213
+ (while (> n 0 )
2214
+ (search-backward-regexp " ([^-]*->" limit)
2215
+ (if (clojure--nothing-more-to-unwind)
2216
+ (progn (clojure--pop-out-of-threading)
2217
+ (clojure--fix-sexp-whitespace)
2218
+ (setq n 0 )) ; ; break out of loop
2219
+ (down-list )
2220
+ (cond
2221
+ ((looking-at " [^-]*->\\ _>" ) (clojure--unwind-first))
2222
+ ((looking-at " [^-]*->>\\ _>" ) (clojure--unwind-last)))
2223
+ (clojure--fix-sexp-whitespace 'move-out )
2224
+ (setq n (1- n)))))))
2222
2225
2223
2226
;;;### autoload
2224
2227
(defun clojure-unwind-all ()
2225
2228
" Fully unwind thread at point or above point."
2226
2229
(interactive )
2227
- (while ( clojure-unwind)))
2230
+ (clojure-unwind '( 4 )))
2228
2231
2229
2232
(defun clojure--remove-superfluous-parens ()
2230
2233
" Remove extra parens from a form."
0 commit comments