summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-09-28 16:22:24 -0500
committerCase Duckworth2021-09-28 16:22:24 -0500
commit0124957b18d900080bc420512ff55adb4ed391dd (patch)
tree906cd6b30a8bb9ba180da045b6d8b8690c67d0fe
parentFix loading (diff)
downloademacs-0124957b18d900080bc420512ff55adb4ed391dd.tar.gz
emacs-0124957b18d900080bc420512ff55adb4ed391dd.zip
Add org-narrow-to-task
-rw-r--r--init.el7
-rw-r--r--lisp/acdw-org.el13
2 files changed, 17 insertions, 3 deletions
diff --git a/init.el b/init.el index a0039ac..5f367bb 100644 --- a/init.el +++ b/init.el
@@ -1893,7 +1893,8 @@ browser defined in `browse-url-secondary-browser-function'."
1893 "C-c C-l" #'org-insert-link-dwim 1893 "C-c C-l" #'org-insert-link-dwim
1894 "C-c w" #'chd/do-the-thing 1894 "C-c w" #'chd/do-the-thing
1895 "C-c C-n" #'acdw/org-next-heading-widen 1895 "C-c C-n" #'acdw/org-next-heading-widen
1896 "C-c C-p" #'acdw/org-previous-heading-widen) 1896 "C-c C-p" #'acdw/org-previous-heading-widen
1897 "C-x n t" #'org-narrow-to-task)
1897 1898
1898 (:unbind "C-'") 1899 (:unbind "C-'")
1899 1900
@@ -1990,8 +1991,8 @@ the default is \"/\"."
1990 collect 1991 collect
1991 (el-patch-swap 1992 (el-patch-swap
1992 (org-add-props 1993 (org-add-props
1993 head nil 'face 1994 head nil 'face
1994 (nth (% n org-n-level-faces) org-level-faces)) 1995 (nth (% n org-n-level-faces) org-level-faces))
1995 head)) 1996 head))
1996 separator)))) 1997 separator))))
1997 (when (> (length fpath) width) 1998 (when (> (length fpath) width)
diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index 96f3f69..8821b28 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el
@@ -451,6 +451,19 @@ probably abandon it at some point for a better solution (see:
451 (nth day-of-week '("Sun" "Mon" "Tue" "Wed" "Thu" 451 (nth day-of-week '("Sun" "Mon" "Tue" "Wed" "Thu"
452 "Fri" "Sat")) 452 "Fri" "Sat"))
453 "]"))))))) 453 "]")))))))
454
455;;; Org task stuff
456
457(defun org-narrow-to-task ()
458 "Narrow buffer to the nearest task and its subtree."
459 (interactive)
460 (save-excursion
461 (save-match-data
462 (widen)
463 (while (not (org-entry-is-todo-p))
464 ;; TODO: need a better error message
465 (org-previous-visible-heading 1))
466 (org-narrow-to-subtree))))
454 467
455 468
456(provide 'acdw-org) 469(provide 'acdw-org)