forked from colonelpanic/dotfiles
[Emacs] Add the ability to set completer
This commit is contained in:
parent
96371e574b
commit
8d08d746e5
@ -237,15 +237,29 @@ We're going to use this to write separate parts of our config to different secti
|
|||||||
(defun imalison:org-known-assignees ()
|
(defun imalison:org-known-assignees ()
|
||||||
imalison:org-people)
|
imalison:org-people)
|
||||||
|
|
||||||
(cl-defun imalison:set-assignee (&key assignee (override t))
|
(defun imalison:set-person-for-prop (&rest args)
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((chosen-assignee (if (called-interactively-p 'interactive)
|
(if (eq major-mode 'org-agenda-mode)
|
||||||
(completing-read "Choose assignee: "
|
(org-agenda-with-point-at-orig-entry nil
|
||||||
(imalison:org-known-assignees)
|
(apply 'imalison--set-person-for-prop args))
|
||||||
nil t)
|
(apply 'imalison--set-person-for-prop args)))
|
||||||
(or assignee imalison:org-whoami))))
|
|
||||||
(when (or override (not (org-entry-get nil "ASSIGNEE")))
|
(cl-defun imalison--set-person-for-prop (&key assignee (override t) (property "ASSIGNEE"))
|
||||||
(org-set-property "ASSIGNEE" chosen-assignee))))
|
(interactive)
|
||||||
|
(let ((chosen-person
|
||||||
|
(if (null assignee)
|
||||||
|
(completing-read "Choose person: "
|
||||||
|
(imalison:org-known-assignees)
|
||||||
|
nil t)
|
||||||
|
(or assignee imalison:org-whoami))))
|
||||||
|
(when (or override (not (org-entry-get nil property)))
|
||||||
|
(org-set-property property chosen-person))))
|
||||||
|
|
||||||
|
(defalias 'imalison:set-assignee 'imalison:set-person-for-prop)
|
||||||
|
|
||||||
|
(defun imalison:set-completer (&rest args)
|
||||||
|
(interactive)
|
||||||
|
(apply 'imalison:set-person-for-prop :property "COMPLETER" args))
|
||||||
|
|
||||||
(defun imalison:assign-to-self-if-unassigned ()
|
(defun imalison:assign-to-self-if-unassigned ()
|
||||||
(interactive)
|
(interactive)
|
||||||
@ -279,7 +293,7 @@ We're going to use this to write separate parts of our config to different secti
|
|||||||
|
|
||||||
(defun imalison:relevant-to (person)
|
(defun imalison:relevant-to (person)
|
||||||
(let ((assignee (org-entry-get nil "ASSIGNEE"))
|
(let ((assignee (org-entry-get nil "ASSIGNEE"))
|
||||||
(completer (org-entry-get nil "COMPLETER")))
|
(completer (org-entry-get nil "COMPLETER")))
|
||||||
(or
|
(or
|
||||||
(null person)
|
(null person)
|
||||||
(string-equal assignee person)
|
(string-equal assignee person)
|
||||||
@ -292,8 +306,8 @@ We're going to use this to write separate parts of our config to different secti
|
|||||||
|
|
||||||
(defmacro imalison:assigned-to-me ()
|
(defmacro imalison:assigned-to-me ()
|
||||||
`(let ((assignee (org-entry-get nil "ASSIGNEE")))
|
`(let ((assignee (org-entry-get nil "ASSIGNEE")))
|
||||||
(or (string-equal assignee imalison:org-whoami)
|
(or (string-equal assignee imalison:org-whoami)
|
||||||
(null assignee))))
|
(null assignee))))
|
||||||
|
|
||||||
(defalias 'imalison:assigned-to-me-agenda-pred
|
(defalias 'imalison:assigned-to-me-agenda-pred
|
||||||
(imalison:def-agenda-pred
|
(imalison:def-agenda-pred
|
||||||
|
Loading…
Reference in New Issue
Block a user