chore(scratch): remove old scratch definitions

This commit is contained in:
Kiana Sheibani 2024-08-14 06:49:38 -04:00
parent 6451bca16a
commit 3e46106e90
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -4004,50 +4004,3 @@ This section is for code with little or no associated documentation. This could
2. Self-explanatory
3. Hard to categorize
4. Just not really worth the time it takes to write commentary
** Org
*** Automate Problem List
#+begin_src emacs-lisp
(defvar ~/org-problem-spec-alist nil
"An alist of regexps matching problem specs.")
(setq ~/org-problem-spec-alist
`((,(rx (group (+ digit))
(* space) "-" (* space)
(group (+ digit))
(* space) "odd")
. ,(lambda (beg end)
(when (cl-evenp beg) (cl-incf beg))
(number-sequence beg end 2)))
(,(rx (group (+ digit))
(* space) "-" (* space)
(group (+ digit))
(* space) "even")
. ,(lambda (beg end)
(when (cl-oddp beg) (cl-incf beg))
(number-sequence beg end 2)))
(,(rx (group (+ digit))
(* space) "-" (* space)
(group (+ digit))) . number-sequence)
(,(rx (group (+ digit))) . list)))
(defun ~/org-generate-problem-list (&rest specs)
(interactive (s-split "," (read-from-minibuffer "Problems: ")))
(let* ((alist ~/org-problem-spec-alist)
(problems
(mapcan
(lambda (spec)
(let* ((match
(or (--some (-some-> (s-match (car it) spec)
cdr (cons (cdr it)))
alist)
(user-error "Invalid problem spec \"%s\"" spec))))
(apply (cdr match) (mapcar #'string-to-number (car match)))))
specs)))
(move-to-left-margin)
(dolist (num problems)
(insert (format "- [ ] %d\n" num)))))
#+end_src