about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-08-19 17:30:34 -0500
committerCase Duckworth2021-08-19 17:30:34 -0500
commit3a055f33e8e475a5f67ec4143d7c798ec2e79d13 (patch)
tree65e426013734a187622f17c002444ce211157871 /lisp
parentUpdate `acdw/copy-text-plain' (diff)
parentAdd `sort-setq' (diff)
downloademacs-3a055f33e8e475a5f67ec4143d7c798ec2e79d13.tar.gz
emacs-3a055f33e8e475a5f67ec4143d7c798ec2e79d13.zip
Merge branch 'main' of tildegit.org:acdw/emacs
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 30cf8af..f642c65 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -535,5 +535,36 @@ It's called 'require-private' for historical reasons."
535 (when (fboundp mode) 535 (when (fboundp mode)
536 (funcall mode -1))))) 536 (funcall mode -1)))))
537 537
538
539;;; Sort setq...
540;; https://emacs.stackexchange.com/questions/33039/
541
542(defun sort-setq ()
543 (interactive)
544 (save-excursion
545 (save-restriction
546 (let ((sort-end (progn (end-of-defun)
547 (backward-char)
548 (point-marker)))
549 (sort-beg (progn (beginning-of-defun)
550 (re-search-forward "[ \\t]*(" (point-at-eol))
551 (forward-sexp)
552 (re-search-forward "\\<" (point-at-eol))
553 (point-marker))))
554 (narrow-to-region (1- sort-beg) (1+ sort-end))
555 (sort-subr nil #'sort-setq-next-record #'sort-setq-end-record)))))
556
557(defun sort-setq-next-record ()
558 (condition-case nil
559 (progn
560 (forward-sexp 1)
561 (backward-sexp))
562 ('scan-error (end-of-buffer))))
563
564(defun sort-setq-end-record ()
565 (condition-case nil
566 (forward-sexp 2)
567 ('scan-error (end-of-buffer))))
568
538(provide 'acdw) 569(provide 'acdw)
539;;; acdw.el ends here 570;;; acdw.el ends here