Sort init.el by package

This commit is contained in:
Case Duckworth 2021-09-04 10:38:06 -05:00
parent 32236e79f0
commit 06770985d7
2 changed files with 1208 additions and 1174 deletions

2363
init.el

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,9 @@
;; functions for me, acdw.
;;; Code:
(require 'cl-lib)
;;; Variables
(defconst acdw/system
@ -242,10 +244,12 @@ With a prefix argument N, (un)comment that many sexps."
;;; Sort sexps
;; from https://github.com/alphapapa/unpackaged.el#sort-sexps
;; and https://github.com/alphapapa/unpackaged.el/issues/20
(defun sort-sexps (beg end)
(defun sort-sexps (beg end &optional key)
"Sort sexps in region.
Comments stay with the code below."
Comments stay with the code below. KEY is a function to sort by,
e.g. (lambda (sexp) (symbol-name (car sexp)))"
(interactive "r")
(cl-flet ((skip-whitespace () (while (looking-at (rx (1+ (or space "\n"))))
(goto-char (match-end 0))))
@ -270,11 +274,16 @@ Comments stay with the code below."
for end = (point-marker)
while sexp
;; Collect the real string, then one used for sorting.
collect (cons (buffer-substring (marker-position start) (marker-position end))
collect (cons (buffer-substring (marker-position start)
(marker-position end))
(save-excursion
(goto-char (marker-position start))
(skip-both)
(buffer-substring (point) (marker-position end))))
(if key
(funcall key sexp)
(buffer-substring
(point)
(marker-position end)))))
into sexps
collect (cons start end)
into markers