chore(scratch): remove old scratch definitions
This commit is contained in:
parent
6451bca16a
commit
3e46106e90
47
config.org
47
config.org
|
@ -4004,50 +4004,3 @@ This section is for code with little or no associated documentation. This could
|
||||||
2. Self-explanatory
|
2. Self-explanatory
|
||||||
3. Hard to categorize
|
3. Hard to categorize
|
||||||
4. Just not really worth the time it takes to write commentary
|
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
|
|
||||||
|
|
Loading…
Reference in a new issue