about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-01-17 01:19:43 -0600
committerCase Duckworth2022-01-17 01:19:43 -0600
commitee1720b8ade5266efd0895b7b2fd1d820b8cdd56 (patch)
tree24318f16cbfe827b051d7797c5abd51b3823c13a /lisp
parentAdd ytdious (diff)
downloademacs-ee1720b8ade5266efd0895b7b2fd1d820b8cdd56.tar.gz
emacs-ee1720b8ade5266efd0895b7b2fd1d820b8cdd56.zip
Add sort-setq
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+emacs.el6
-rw-r--r--lisp/+lisp.el33
2 files changed, 37 insertions, 2 deletions
diff --git a/lisp/+emacs.el b/lisp/+emacs.el index 312657e..1679886 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el
@@ -43,6 +43,7 @@ Do this only if the buffer is not visiting a file."
43 backup-by-copying t 43 backup-by-copying t
44 backup-directory-alist `((".*" . ,(.etc "backup/" t))) 44 backup-directory-alist `((".*" . ,(.etc "backup/" t)))
45 blink-cursor-blinks 1 45 blink-cursor-blinks 1
46 comp-deferred-compilation nil
46 completion-category-defaults nil 47 completion-category-defaults nil
47 completion-category-overrides '((file (styles . (partial-completion)))) 48 completion-category-overrides '((file (styles . (partial-completion))))
48 completion-ignore-case t 49 completion-ignore-case t
@@ -68,15 +69,15 @@ Do this only if the buffer is not visiting a file."
68 hscroll-step 1 69 hscroll-step 1
69 imenu-auto-rescan t 70 imenu-auto-rescan t
70 indent-tabs-mode nil 71 indent-tabs-mode nil
71 indicate-empty-lines nil
72 indicate-buffer-boundaries 'left 72 indicate-buffer-boundaries 'left
73 indicate-empty-lines nil
73 inhibit-startup-screen t 74 inhibit-startup-screen t
74 initial-buffer-choice t 75 initial-buffer-choice t
75 kill-do-not-save-duplicates t 76 kill-do-not-save-duplicates t
76 kill-read-only-ok t 77 kill-read-only-ok t
77 kill-ring-max 500 78 kill-ring-max 500
78 kmacro-ring-max 20 79 kmacro-ring-max 20
79 load-prefer-newer t 80 load-prefer-newer noninteractive
80 major-mode '+set-major-mode-from-buffer-name 81 major-mode '+set-major-mode-from-buffer-name
81 mark-ring-max 50 82 mark-ring-max 50
82 minibuffer-eldef-shorten-default t 83 minibuffer-eldef-shorten-default t
@@ -88,6 +89,7 @@ Do this only if the buffer is not visiting a file."
88 mouse-wheel-progressive-speed nil 89 mouse-wheel-progressive-speed nil
89 mouse-yank-at-point t 90 mouse-yank-at-point t
90 native-comp-async-report-warnings-errors 'silent 91 native-comp-async-report-warnings-errors 'silent
92 native-comp-deferred-compilation nil
91 read-answer-short t 93 read-answer-short t
92 read-buffer-completion-ignore-case t 94 read-buffer-completion-ignore-case t
93 read-extended-command-predicate (when (fboundp 95 read-extended-command-predicate (when (fboundp
diff --git a/lisp/+lisp.el b/lisp/+lisp.el index 07dfcbd..c45fdf6 100644 --- a/lisp/+lisp.el +++ b/lisp/+lisp.el
@@ -156,5 +156,38 @@ With a prefix argument N, (un)comment that many sexps."
156 (dotimes (_ (or n 1)) 156 (dotimes (_ (or n 1))
157 (+lisp-comment-sexp--raw)))) 157 (+lisp-comment-sexp--raw))))
158 158
159;;; Sort `setq' constructs
160(defun +lisp-sort-setq ()
161 (interactive)
162 (save-excursion
163 (save-restriction
164 (let ((sort-end (progn
165 (end-of-defun)
166 (backward-char)
167 (point-marker)))
168 (sort-beg (progn
169 (beginning-of-defun)
170 (or (re-search-forward "[ \\t]*(" (point-at-eol) t)
171 (point-at-eol))
172 (forward-sexp)
173 (or (re-search-forward "\\<" (point-at-eol) t)
174 (point-at-eol))
175 (point-marker))))
176 (narrow-to-region (1- sort-beg) (1+ sort-end))
177 (sort-subr nil #'+lisp-sort-setq-next-record
178 #'+lisp-sort-setq-end-record)))))
179
180(defun +lisp-sort-setq-next-record ()
181 (condition-case nil
182 (progn
183 (forward-sexp 1)
184 (backward-sexp))
185 ('scan-error (end-of-buffer))))
186
187(defun +lisp-sort-setq-end-record ()
188 (condition-case nil
189 (forward-sexp 2)
190 ('scan-error (end-of-buffer))))
191
159(provide '+lisp) 192(provide '+lisp)
160;;; +lisp.el ends here 193;;; +lisp.el ends here