about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lisp/acdw.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 2be0c4e..27f5eff 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -513,5 +513,36 @@ It's called 'require-private' for historical reasons."
513 (when (fboundp mode) 513 (when (fboundp mode)
514 (funcall mode -1))))) 514 (funcall mode -1)))))
515 515
516
517;;; Sort setq...
518;; https://emacs.stackexchange.com/questions/33039/
519
520(defun sort-setq ()
521 (interactive)
522 (save-excursion
523 (save-restriction
524 (let ((sort-end (progn (end-of-defun)
525 (backward-char)
526 (point-marker)))
527 (sort-beg (progn (beginning-of-defun)
528 (re-search-forward "[ \\t]*(" (point-at-eol))
529 (forward-sexp)
530 (re-search-forward "\\<" (point-at-eol))
531 (point-marker))))
532 (narrow-to-region (1- sort-beg) (1+ sort-end))
533 (sort-subr nil #'sort-setq-next-record #'sort-setq-end-record)))))
534
535(defun sort-setq-next-record ()
536 (condition-case nil
537 (progn
538 (forward-sexp 1)
539 (backward-sexp))
540 ('scan-error (end-of-buffer))))
541
542(defun sort-setq-end-record ()
543 (condition-case nil
544 (forward-sexp 2)
545 ('scan-error (end-of-buffer))))
546
516(provide 'acdw) 547(provide 'acdw)
517;;; acdw.el ends here 548;;; acdw.el ends here