|
|
|
|
@ -1525,6 +1525,38 @@ |
|
|
|
|
(lambda () |
|
|
|
|
(when buffer-file-name (save-buffer-with-timer 5)))) |
|
|
|
|
#+end_src |
|
|
|
|
*** cycling-headlines |
|
|
|
|
This bit is useful to cycle headings in files; the interesting |
|
|
|
|
variable should be buffer-local |
|
|
|
|
#+begin_src emacs-lisp |
|
|
|
|
(setq org-heading-cycle-list nil) |
|
|
|
|
|
|
|
|
|
(defun next-heading-in-cycle-list (heading cycle-list) |
|
|
|
|
(when cycle-list |
|
|
|
|
(or (next-heading-in-cycle heading (car cycle-list)) |
|
|
|
|
(next-heading-in-cycle-list heading (cdr cycle-list))))) |
|
|
|
|
|
|
|
|
|
(defun next-heading-in-cycle (heading cycle) |
|
|
|
|
"Returns the next heading in the cycle or nil if none" |
|
|
|
|
(let ((pos (cl-position heading cycle :test 'equal)) |
|
|
|
|
(len (length cycle))) |
|
|
|
|
(when pos |
|
|
|
|
(let ((next (mod (+ 1 pos) len))) |
|
|
|
|
(nth next cycle))))) |
|
|
|
|
|
|
|
|
|
(defun wilder/org-cycle-headlines () |
|
|
|
|
(when (equal org-state "DONE") |
|
|
|
|
(let* ((current-heading (org-entry-get nil "ITEM")) |
|
|
|
|
(next-heading (next-heading-in-cycle-list current-heading org-heading-cycle-list))) |
|
|
|
|
(when next-heading |
|
|
|
|
(org-edit-headline next-heading))))) |
|
|
|
|
#+end_src |
|
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp |
|
|
|
|
(add-hook 'org-after-todo-state-change-hook |
|
|
|
|
#'wilder/org-cycle-headlines) |
|
|
|
|
#+end_src |
|
|
|
|
|
|
|
|
|
*** Reverting stuff from orgzly |
|
|
|
|
#+begin_src emacs-lisp |
|
|
|
|
(defun org-revert-all-orgzly-buffers (&optional ALL) |
|
|
|
|
|