ADD id linker for agenda headlines
This commit is contained in:
parent
d194dff430
commit
c5b05047d2
|
@ -2536,8 +2536,8 @@ NOTE: Capitalized entries store a link to the capture along with writing to the
|
||||||
|
|
||||||
("M" "metablock" entry (file+olp+datetree "~/Org/metablocks.org")
|
("M" "metablock" entry (file+olp+datetree "~/Org/metablocks.org")
|
||||||
,(concat "* %^{Metablock Title}\n"
|
,(concat "* %^{Metablock Title}\n"
|
||||||
"%^{Effort}p"
|
|
||||||
"%^t\n"
|
"%^t\n"
|
||||||
|
"%^{Effort}p"
|
||||||
"%?"))
|
"%?"))
|
||||||
|
|
||||||
;; or capturing links with web browser
|
;; or capturing links with web browser
|
||||||
|
@ -4274,6 +4274,7 @@ These are for mode-specific bindings that can/should be outside of the evil maps
|
||||||
(add-hook 'org-agenda-mode-hook
|
(add-hook 'org-agenda-mode-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(local-set-key (kbd "C-c C-c") 'org-agenda-set-tags)
|
(local-set-key (kbd "C-c C-c") 'org-agenda-set-tags)
|
||||||
|
(local-set-key (kbd "C-c L") 'org-x-agenda-id-store-link)
|
||||||
(local-set-key (kbd "C-c C-x c") 'org-x-agenda-clone-subtree-with-time-shift)
|
(local-set-key (kbd "C-c C-x c") 'org-x-agenda-clone-subtree-with-time-shift)
|
||||||
(local-set-key (kbd "C-c C-x C-b") 'org-x-agenda-toggle-checkbox)
|
(local-set-key (kbd "C-c C-x C-b") 'org-x-agenda-toggle-checkbox)
|
||||||
(local-set-key (kbd "C-c C-x C-r") 'org-x-agenda-clock-range)
|
(local-set-key (kbd "C-c C-x C-r") 'org-x-agenda-clock-range)
|
||||||
|
|
|
@ -1649,50 +1649,60 @@ If ARG is non-nil use long timestamp format."
|
||||||
|
|
||||||
;; lift buffer commands into agenda context
|
;; lift buffer commands into agenda context
|
||||||
|
|
||||||
(defmacro org-x-agenda-cmd-wrapper (get-head &rest body)
|
(defmacro org-x-agenda-cmd-wrapper (update &rest body)
|
||||||
"Execute BODY in context of agenda buffer.
|
"Execute BODY in context of agenda buffer.
|
||||||
Specifically, navigate to the original header, execute BODY, then
|
Specifically, navigate to the original header, execute BODY, then
|
||||||
update the agenda buffer. If GET-HEAD is true, get the headline
|
update the agenda buffer. If UPDATE is 'update-headline', get the
|
||||||
string and use it to update the agenda (this is only needed when
|
headline string and use it to update the agenda (this is only
|
||||||
the headline changes obviously)."
|
needed when the headline changes obviously). When update is
|
||||||
|
'update-all', reload the entire buffer. When UPDATE is nil, do
|
||||||
|
nothing."
|
||||||
(declare (indent 1))
|
(declare (indent 1))
|
||||||
|
(-let* ((newhead (make-symbol "newhead"))
|
||||||
|
(hdmarker (make-symbol "hdmarker"))
|
||||||
|
((update-form get-head-form)
|
||||||
|
(cond
|
||||||
|
((eq update 'update-headline)
|
||||||
|
(list `((org-agenda-change-all-lines ,newhead ,hdmarker))
|
||||||
|
`((setq ,newhead (org-get-heading)))))
|
||||||
|
((eq update 'update-all)
|
||||||
|
(list '((org-agenda-redo))
|
||||||
|
nil)))))
|
||||||
`(progn
|
`(progn
|
||||||
(org-agenda-check-no-diary)
|
(org-agenda-check-no-diary)
|
||||||
(let* ((hdmarker (or (org-get-at-bol 'org-hd-marker)
|
(let* ((,hdmarker (or (org-get-at-bol 'org-hd-marker)
|
||||||
(org-agenda-error)))
|
(org-agenda-error)))
|
||||||
(buffer (marker-buffer hdmarker))
|
(buffer (marker-buffer ,hdmarker))
|
||||||
(pos (marker-position hdmarker))
|
(pos (marker-position ,hdmarker))
|
||||||
(inhibit-read-only t)
|
(inhibit-read-only t)
|
||||||
newhead)
|
,newhead)
|
||||||
(org-with-remote-undo buffer
|
(org-with-remote-undo buffer
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(widen)
|
(widen)
|
||||||
(goto-char pos)
|
(goto-char pos)
|
||||||
(org-show-context 'agenda)
|
(org-show-context 'agenda)
|
||||||
,@body
|
,@body
|
||||||
(when ,get-head (setq newhead (org-get-heading))))
|
,@get-head-form)
|
||||||
(if ,get-head
|
,@update-form
|
||||||
(org-agenda-change-all-lines newhead hdmarker)
|
(beginning-of-line 1))))))
|
||||||
(org-agenda-redo))
|
|
||||||
(beginning-of-line 1)))))
|
|
||||||
|
|
||||||
(defun org-x-agenda-toggle-checkbox ()
|
(defun org-x-agenda-toggle-checkbox ()
|
||||||
"Toggle checkboxes in org agenda view using `org-toggle-checkbox'."
|
"Toggle checkboxes in org agenda view using `org-toggle-checkbox'."
|
||||||
(interactive)
|
(interactive)
|
||||||
(org-x-agenda-cmd-wrapper t
|
(org-x-agenda-cmd-wrapper update-headline
|
||||||
(call-interactively #'org-toggle-checkbox)))
|
(call-interactively #'org-toggle-checkbox)))
|
||||||
|
|
||||||
(defun org-x-agenda-clone-subtree-with-time-shift ()
|
(defun org-x-agenda-clone-subtree-with-time-shift ()
|
||||||
"Apply `org-x-clone-subtree-with-time-shift' to an agenda entry.
|
"Apply `org-x-clone-subtree-with-time-shift' to an agenda entry.
|
||||||
It will clone the last entry in the selected subtree."
|
It will clone the last entry in the selected subtree."
|
||||||
(interactive)
|
(interactive)
|
||||||
(org-x-agenda-cmd-wrapper nil
|
(org-x-agenda-cmd-wrapper update-all
|
||||||
(call-interactively #'org-x-clone-subtree-with-time-shift-toplevel)))
|
(call-interactively #'org-x-clone-subtree-with-time-shift-toplevel)))
|
||||||
|
|
||||||
(defun org-x-agenda-delete-subtree ()
|
(defun org-x-agenda-delete-subtree ()
|
||||||
"Apply `org-x-delete-subtree' to an agenda entry."
|
"Apply `org-x-delete-subtree' to an agenda entry."
|
||||||
(interactive)
|
(interactive)
|
||||||
(org-x-agenda-cmd-wrapper nil
|
(org-x-agenda-cmd-wrapper update-all
|
||||||
(call-interactively #'org-x-delete-subtree)))
|
(call-interactively #'org-x-delete-subtree)))
|
||||||
|
|
||||||
(defun org-x-agenda-clock-range ()
|
(defun org-x-agenda-clock-range ()
|
||||||
|
@ -1701,6 +1711,12 @@ It will clone the last entry in the selected subtree."
|
||||||
(org-x-agenda-cmd-wrapper nil
|
(org-x-agenda-cmd-wrapper nil
|
||||||
(call-interactively #'org-x-clock-range)))
|
(call-interactively #'org-x-clock-range)))
|
||||||
|
|
||||||
|
(defun org-x-agenda-id-store-link ()
|
||||||
|
"Apply `org-x-id-store-link' to an agenda entry."
|
||||||
|
(interactive)
|
||||||
|
(org-x-agenda-cmd-wrapper nil
|
||||||
|
(call-interactively #'org-x-id-store-link)))
|
||||||
|
|
||||||
;; agenda heading navigation functions
|
;; agenda heading navigation functions
|
||||||
|
|
||||||
(defun org-x-agenda--seek-heading (&optional back)
|
(defun org-x-agenda--seek-heading (&optional back)
|
||||||
|
|
Loading…
Reference in New Issue