Guest User

Untitled

a guest
Dec 11th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. (defun simpson-org-to-todo()
  2. "Convert a line (or region) in an org file to a TODO"
  3. (interactive)
  4. (let ((heading "") (i 1) (number (read-number "What level?" 1)))
  5. (while (<= i number)
  6. (setq heading (concat heading "*"))
  7. (setq i (+ i 1)))
  8. (if (region-active-p)
  9. (let ((strings (seq-map (lambda(x) (concat heading " TODO " x))
  10. (split-string (buffer-substring-no-properties (region-beginning) (region-end)) "\n" t))))
  11. (delete-active-region)
  12. (insert (mapconcat 'identity strings "\n")))
  13. (org-beginning-of-line)
  14. (insert heading " TODO ") t)))
Add Comment
Please, Sign In to add comment