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))
|
||||||
`(progn
|
(-let* ((newhead (make-symbol "newhead"))
|
||||||
(org-agenda-check-no-diary)
|
(hdmarker (make-symbol "hdmarker"))
|
||||||
(let* ((hdmarker (or (org-get-at-bol 'org-hd-marker)
|
((update-form get-head-form)
|
||||||
(org-agenda-error)))
|
(cond
|
||||||
(buffer (marker-buffer hdmarker))
|
((eq update 'update-headline)
|
||||||
(pos (marker-position hdmarker))
|
(list `((org-agenda-change-all-lines ,newhead ,hdmarker))
|
||||||
(inhibit-read-only t)
|
`((setq ,newhead (org-get-heading)))))
|
||||||
newhead)
|
((eq update 'update-all)
|
||||||
(org-with-remote-undo buffer
|
(list '((org-agenda-redo))
|
||||||
(with-current-buffer buffer
|
nil)))))
|
||||||
(widen)
|
`(progn
|
||||||
(goto-char pos)
|
(org-agenda-check-no-diary)
|
||||||
(org-show-context 'agenda)
|
(let* ((,hdmarker (or (org-get-at-bol 'org-hd-marker)
|
||||||
,@body
|
(org-agenda-error)))
|
||||||
(when ,get-head (setq newhead (org-get-heading))))
|
(buffer (marker-buffer ,hdmarker))
|
||||||
(if ,get-head
|
(pos (marker-position ,hdmarker))
|
||||||
(org-agenda-change-all-lines newhead hdmarker)
|
(inhibit-read-only t)
|
||||||
(org-agenda-redo))
|
,newhead)
|
||||||
(beginning-of-line 1)))))
|
(org-with-remote-undo buffer
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(widen)
|
||||||
|
(goto-char pos)
|
||||||
|
(org-show-context 'agenda)
|
||||||
|
,@body
|
||||||
|
,@get-head-form)
|
||||||
|
,@update-form
|
||||||
|
(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