abo-abo / lispy

Short and sweet LISP editing
http://oremacs.com/lispy/
1.19k stars 129 forks source link

lispy-toggle-thread-last fails with comments #660

Open RuijieYu opened 1 year ago

RuijieYu commented 1 year ago

See the following two pairs of snippets, where I press x > with point=1.

With comments (incorrect)

Before:

(expand-file-name
 ;;
 (car (ensure-list dired-directory)))

After:

(thread-last ;;
             (expand-file-name)
             (car (ensure-list dired-directory)))

Without comments (correct)

Before:

(expand-file-name
 (car (ensure-list dired-directory)))

After:

(thread-last (ensure-list dired-directory) (car)
             (expand-file-name))
RuijieYu commented 1 year ago

In addition, when we convert thread-last form back to regular form, all comments within it are lost. Further, converting this snippet also fails:

(thread-last (ensure-list dired-directory) ;
             (car)
             (expand-file-name))

Gets to:

(ensure-list dired-directory)

Notice that the call to car is now gone because of the trailing comment. I suspect the same issue is also manifested in #657.