Add sort-setq
This commit is contained in:
parent
5fe7d70d08
commit
ee1720b8ad
|
@ -43,6 +43,7 @@ Do this only if the buffer is not visiting a file."
|
|||
backup-by-copying t
|
||||
backup-directory-alist `((".*" . ,(.etc "backup/" t)))
|
||||
blink-cursor-blinks 1
|
||||
comp-deferred-compilation nil
|
||||
completion-category-defaults nil
|
||||
completion-category-overrides '((file (styles . (partial-completion))))
|
||||
completion-ignore-case t
|
||||
|
@ -68,15 +69,15 @@ Do this only if the buffer is not visiting a file."
|
|||
hscroll-step 1
|
||||
imenu-auto-rescan t
|
||||
indent-tabs-mode nil
|
||||
indicate-empty-lines nil
|
||||
indicate-buffer-boundaries 'left
|
||||
indicate-empty-lines nil
|
||||
inhibit-startup-screen t
|
||||
initial-buffer-choice t
|
||||
kill-do-not-save-duplicates t
|
||||
kill-read-only-ok t
|
||||
kill-ring-max 500
|
||||
kmacro-ring-max 20
|
||||
load-prefer-newer t
|
||||
load-prefer-newer noninteractive
|
||||
major-mode '+set-major-mode-from-buffer-name
|
||||
mark-ring-max 50
|
||||
minibuffer-eldef-shorten-default t
|
||||
|
@ -88,6 +89,7 @@ Do this only if the buffer is not visiting a file."
|
|||
mouse-wheel-progressive-speed nil
|
||||
mouse-yank-at-point t
|
||||
native-comp-async-report-warnings-errors 'silent
|
||||
native-comp-deferred-compilation nil
|
||||
read-answer-short t
|
||||
read-buffer-completion-ignore-case t
|
||||
read-extended-command-predicate (when (fboundp
|
||||
|
|
|
@ -156,5 +156,38 @@ With a prefix argument N, (un)comment that many sexps."
|
|||
(dotimes (_ (or n 1))
|
||||
(+lisp-comment-sexp--raw))))
|
||||
|
||||
;;; Sort `setq' constructs
|
||||
(defun +lisp-sort-setq ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(let ((sort-end (progn
|
||||
(end-of-defun)
|
||||
(backward-char)
|
||||
(point-marker)))
|
||||
(sort-beg (progn
|
||||
(beginning-of-defun)
|
||||
(or (re-search-forward "[ \\t]*(" (point-at-eol) t)
|
||||
(point-at-eol))
|
||||
(forward-sexp)
|
||||
(or (re-search-forward "\\<" (point-at-eol) t)
|
||||
(point-at-eol))
|
||||
(point-marker))))
|
||||
(narrow-to-region (1- sort-beg) (1+ sort-end))
|
||||
(sort-subr nil #'+lisp-sort-setq-next-record
|
||||
#'+lisp-sort-setq-end-record)))))
|
||||
|
||||
(defun +lisp-sort-setq-next-record ()
|
||||
(condition-case nil
|
||||
(progn
|
||||
(forward-sexp 1)
|
||||
(backward-sexp))
|
||||
('scan-error (end-of-buffer))))
|
||||
|
||||
(defun +lisp-sort-setq-end-record ()
|
||||
(condition-case nil
|
||||
(forward-sexp 2)
|
||||
('scan-error (end-of-buffer))))
|
||||
|
||||
(provide '+lisp)
|
||||
;;; +lisp.el ends here
|
||||
|
|
Loading…
Reference in New Issue