diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw.el | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 4043134..6e66838 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -330,26 +330,23 @@ In short, DO NOT USE THIS FUNCTION!!!" | |||
330 | (save-excursion | 330 | (save-excursion |
331 | (sort-sexps | 331 | (sort-sexps |
332 | (point-min) (point-max) | 332 | (point-min) (point-max) |
333 | (lambda (sexp) | 333 | ;; Key function |
334 | (format "%S" (cadr sexp))) | 334 | nil |
335 | ;; Sort function | ||
335 | (lambda (s1 s2) ; oh god, this is worse. | 336 | (lambda (s1 s2) ; oh god, this is worse. |
336 | (let* ((s1 (cdr s1)) (s2 (cdr s2)) ; for the strings themselves | 337 | (let* ((s1 (cdr s1)) (s2 (cdr s2)) ; for the strings themselves |
337 | (s1-require (string-match ":require" s1)) | 338 | (require-regexp (rx bos (* nonl) ":require")) |
338 | (s2-require (string-match ":require" s2)) | 339 | (straight-regexp (rx bos (* nonl) ":straight")) |
339 | (s1-straight (string-match ":straight" s1)) | 340 | (s1-require (string-match require-regexp s1)) |
340 | (s2-straight (string-match ":straight" s2)) | 341 | (s2-require (string-match require-regexp s2)) |
341 | (s1-bare (not (or s1-require s1-straight))) | 342 | (s1-straight (string-match straight-regexp s1)) |
342 | (s2-bare (not (or s2-require s2-straight)))) | 343 | (s2-straight (string-match straight-regexp s2))) |
343 | (cond | 344 | (cond |
344 | ;; if both are the same, sort regular style | 345 | ;; Straight forms require some weirdness |
345 | ((or (and s1-require s2-require) | ||
346 | (and s1-bare s2-bare)) | ||
347 | (string< s1 s2)) | ||
348 | ((and s1-straight s2-straight) | 346 | ((and s1-straight s2-straight) |
349 | (let* ((r (rx ":straight" (? "-if") (* space) (? "("))) | 347 | (let* ((r (rx ":straight" (? "-if") (* space) (? "("))) |
350 | (s1 (replace-regexp-in-string r "" s1)) | 348 | (s1 (replace-regexp-in-string r "" s1)) |
351 | (s2 (replace-regexp-in-string r "" s2))) | 349 | (s2 (replace-regexp-in-string r "" s2))) |
352 | (message "'%S' '%S'" s1 s2) | ||
353 | (string< s1 s2))) | 350 | (string< s1 s2))) |
354 | ;; requires should go first | 351 | ;; requires should go first |
355 | ((and s1-require (not s2-require)) t) | 352 | ((and s1-require (not s2-require)) t) |