added TIME_SHIFT property

This commit is contained in:
petrucci4prez 2018-05-19 15:36:04 -04:00
parent 3f55f7bac0
commit ab801038ad
2 changed files with 63 additions and 55 deletions

32
conf.el
View File

@ -189,6 +189,14 @@ event of an error or nonlocal exit."
`(advice-remove ,(car adform) ,(nth 2 adform))) `(advice-remove ,(car adform) ,(nth 2 adform)))
adlist)))) adlist))))
(defun nd/filter-list-prefix (prefix str-list)
"Return a subset of tags-list whose first character matches prefix.'
tags-list defaults to org-tag-alist if not given"
(seq-filter (lambda (i)
(and (stringp i)
(string-prefix-p prefix i)))
str-list))
(defun split-and-follow-horizontally () (defun split-and-follow-horizontally ()
(interactive) (interactive)
(split-window-below) (split-window-below)
@ -255,7 +263,7 @@ event of an error or nonlocal exit."
(load "ess-site") (load "ess-site")
(setq ess-history-file "session.Rhistory") (setq ess-history-file "session.Rhistory")
(setq ess-history-directory (setq ess-history-directory
(substitute-in-file-name "${XDG_CONFIG_HOME}/r/")) (substitute-in-file-name "${XDG_CONFIG_HOME}/r/"))
(setq org-log-done t) (setq org-log-done t)
(setq org-startup-indented t) (setq org-startup-indented t)
@ -326,7 +334,7 @@ event of an error or nonlocal exit."
(add-hook 'org-mode-hook (add-hook 'org-mode-hook
(lambda () (lambda ()
(local-set-key (kbd "C-c C-x x") 'nd/mark-subtree-done) (local-set-key (kbd "C-c C-x x") 'nd/mark-subtree-done)
(local-set-key (kbd "C-c C-x c") 'nd/org-clone-subtree-with-time-shift-reset))) (local-set-key (kbd "C-c C-x c") 'nd/org-clone-subtree-with-time-shift)))
(evil-define-key 'motion org-agenda-mode-map (evil-define-key 'motion org-agenda-mode-map
"t" 'nd/toggle-project-toplevel-display "t" 'nd/toggle-project-toplevel-display
@ -355,14 +363,6 @@ event of an error or nonlocal exit."
("HOLD" :foreground "violet" :weight bold) ("HOLD" :foreground "violet" :weight bold)
("CANC" :foreground "deep sky blue" :weight bold))) ("CANC" :foreground "deep sky blue" :weight bold)))
(defun nd/filter-list-prefix (prefix str-list)
"Return a subset of tags-list whose first character matches prefix.'
tags-list defaults to org-tag-alist if not given"
(seq-filter (lambda (i)
(and (stringp i)
(string-prefix-p prefix i)))
str-list))
(defun nd/add-tag-face (fg-name prefix) (defun nd/add-tag-face (fg-name prefix)
"Adds list of cons cells to org-tag-faces with foreground set to fg-name. "Adds list of cons cells to org-tag-faces with foreground set to fg-name.
Start and end specify the positions in org-tag-alist which define the tags Start and end specify the positions in org-tag-alist which define the tags
@ -409,12 +409,14 @@ event of an error or nonlocal exit."
(add-to-list 'org-default-properties "PARENT_TYPE") (add-to-list 'org-default-properties "PARENT_TYPE")
(add-to-list 'org-default-properties "OWNER") (add-to-list 'org-default-properties "OWNER")
(add-to-list 'org-default-properties "GOAL") (add-to-list 'org-default-properties "GOAL")
(add-to-list 'org-default-properties "TIME_SHIFT")
(setq org-global-properties (setq org-global-properties
'(("PARENT_TYPE_ALL" . "periodical iterator") '(("PARENT_TYPE_ALL" . "periodical iterator")
("Effort_ALL" . "0:05 0:15 0:30 1:00 1:30 2:00 3:00 4:00 5:00 6:00"))) ("Effort_ALL" . "0:05 0:15 0:30 1:00 1:30 2:00 3:00 4:00 5:00 6:00")))
;; TODO this may not be needed ;; TODO this may not be needed
(setq org-use-property-inheritance '("PARENT_TYPE")) (setq org-use-property-inheritance '("PARENT_TYPE" "TIME_SHIFT"))
(let ((capfile "~/Org/capture.org")) (let ((capfile "~/Org/capture.org"))
(setq org-capture-templates (setq org-capture-templates
@ -1063,12 +1065,14 @@ is in the optional argument exclude"
(interactive) (interactive)
(nd/mark-subtree-keyword "DONE" '("CANC"))) (nd/mark-subtree-keyword "DONE" '("CANC")))
(defun nd/org-clone-subtree-with-time-shift-reset (n &optional shift) (defun nd/org-clone-subtree-with-time-shift (n &optional shift)
"Like `org-clone-subtree-with-time-shift' except it resets checkboxes "Like `org-clone-subtree-with-time-shift' except it resets checkboxes
and reverts all todo keywords to TODO" and reverts all todo keywords to TODO"
(interactive "nNumber of clones to produce: ") (interactive "nNumber of clones to produce: ")
(let ((shift (read-from-minibuffer
"Date shift per clone (e.g. +1w, empty to copy unchanged): "))) (let ((shift (or (org-entry-get nil "TIME_SHIFT" 'selective)
(read-from-minibuffer
"Date shift per clone (e.g. +1w, empty to copy unchanged): "))))
(condition-case err (condition-case err
(progn (progn
(org-clone-subtree-with-time-shift n shift) (org-clone-subtree-with-time-shift n shift)

View File

@ -495,7 +495,7 @@ By default, the tag selection window obliterates all but the current window...ho
(add-hook 'org-mode-hook (add-hook 'org-mode-hook
(lambda () (lambda ()
(local-set-key (kbd "C-c C-x x") 'nd/mark-subtree-done) (local-set-key (kbd "C-c C-x x") 'nd/mark-subtree-done)
(local-set-key (kbd "C-c C-x c") 'nd/org-clone-subtree-with-time-shift-reset))) (local-set-key (kbd "C-c C-x c") 'nd/org-clone-subtree-with-time-shift)))
#+END_SRC #+END_SRC
*** agenda *** agenda
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -588,15 +588,17 @@ There are several types of tags I use:
#+END_SRC #+END_SRC
** properties ** properties
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(add-to-list 'org-default-properties "PARENT_TYPE") (add-to-list 'org-default-properties "PARENT_TYPE")
(add-to-list 'org-default-properties "OWNER") (add-to-list 'org-default-properties "OWNER")
(add-to-list 'org-default-properties "GOAL") (add-to-list 'org-default-properties "GOAL")
(setq org-global-properties (add-to-list 'org-default-properties "TIME_SHIFT")
'(("PARENT_TYPE_ALL" . "periodical iterator")
("Effort_ALL" . "0:05 0:15 0:30 1:00 1:30 2:00 3:00 4:00 5:00 6:00")))
;; TODO this may not be needed (setq org-global-properties
(setq org-use-property-inheritance '("PARENT_TYPE")) '(("PARENT_TYPE_ALL" . "periodical iterator")
("Effort_ALL" . "0:05 0:15 0:30 1:00 1:30 2:00 3:00 4:00 5:00 6:00")))
;; TODO this may not be needed
(setq org-use-property-inheritance '("PARENT_TYPE" "TIME_SHIFT"))
#+END_SRC #+END_SRC
** capture ** capture
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -1335,40 +1337,42 @@ the agenda does not do this by default...it's annoying
#+END_SRC #+END_SRC
** interactive functions ** interactive functions
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun nd/mark-subtree-keyword (new-keyword &optional exclude) (defun nd/mark-subtree-keyword (new-keyword &optional exclude)
"marks all tasks in a subtree with keyword unless original keyword "marks all tasks in a subtree with keyword unless original keyword
is in the optional argument exclude" is in the optional argument exclude"
(let ((subtree-end (save-excursion (org-end-of-subtree t)))) (let ((subtree-end (save-excursion (org-end-of-subtree t))))
(if (not (listp exclude)) (if (not (listp exclude))
(error "exlude must be a list if provided")) (error "exlude must be a list if provided"))
(save-excursion (save-excursion
(while (< (point) subtree-end) (while (< (point) subtree-end)
(let ((keyword (nd/is-todoitem-p))) (let ((keyword (nd/is-todoitem-p)))
(if (and keyword (not (member keyword exclude))) (if (and keyword (not (member keyword exclude)))
(org-todo new-keyword))) (org-todo new-keyword)))
(outline-next-heading))))) (outline-next-heading)))))
(defun nd/mark-subtree-done () (defun nd/mark-subtree-done ()
"marks all tasks in subtree as DONE unless they are already canc" "marks all tasks in subtree as DONE unless they are already canc"
(interactive) (interactive)
(nd/mark-subtree-keyword "DONE" '("CANC"))) (nd/mark-subtree-keyword "DONE" '("CANC")))
(defun nd/org-clone-subtree-with-time-shift-reset (n &optional shift) (defun nd/org-clone-subtree-with-time-shift (n &optional shift)
"Like `org-clone-subtree-with-time-shift' except it resets checkboxes "Like `org-clone-subtree-with-time-shift' except it resets checkboxes
and reverts all todo keywords to TODO" and reverts all todo keywords to TODO"
(interactive "nNumber of clones to produce: ") (interactive "nNumber of clones to produce: ")
(let ((shift (read-from-minibuffer
"Date shift per clone (e.g. +1w, empty to copy unchanged): "))) (let ((shift (or (org-entry-get nil "TIME_SHIFT" 'selective)
(condition-case err (read-from-minibuffer
(progn "Date shift per clone (e.g. +1w, empty to copy unchanged): "))))
(org-clone-subtree-with-time-shift n shift) (condition-case err
(save-excursion (progn
(dotimes (i n) (org-clone-subtree-with-time-shift n shift)
(org-forward-heading-same-level 1 t) (save-excursion
(org-reset-checkbox-state-subtree) (dotimes (i n)
(nd/mark-subtree-keyword "TODO") (org-forward-heading-same-level 1 t)
(org-cycle)))) (org-reset-checkbox-state-subtree)
(error (message "%s" (error-message-string err)))))) (nd/mark-subtree-keyword "TODO")
(org-cycle))))
(error (message "%s" (error-message-string err))))))
#+END_SRC #+END_SRC
** caldav ** caldav
+BEGIN_SRC emacs-lisp +BEGIN_SRC emacs-lisp