diff options
author | Marco Wahl <marcowahlsoft@gmail.com> | 2019-03-18 17:01:16 +0100 |
---|---|---|
committer | Marco Wahl <marcowahlsoft@gmail.com> | 2019-03-18 17:06:28 +0100 |
commit | 2e92b9abb90420915d4055e34ec8e0753733705b (patch) | |
tree | 3fd97ee08fddbb381d80e599afe94f13e431aa99 | |
parent | ee1ec294056ad71c7356ff8ba3b46d786a606f38 (diff) | |
download | org-mode-2e92b9abb90420915d4055e34ec8e0753733705b.tar.gz |
org-habit: C-u K in agenda toggles display all/today habits
* lisp/org-habit.el (org-habit-toggle-display-in-agenda): New command.
-rw-r--r-- | doc/org-manual.org | 3 | ||||
-rw-r--r-- | etc/ORG-NEWS | 6 | ||||
-rw-r--r-- | lisp/org-habit.el | 13 |
3 files changed, 19 insertions, 3 deletions
diff --git a/doc/org-manual.org b/doc/org-manual.org index cc6cf14..071a7f9 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -4187,7 +4187,8 @@ the way habits are displayed in the agenda. #+vindex: org-habit-show-habits-only-for-today If non-~nil~, only show habits in today's agenda view. The default - value is ~t~. + value is ~t~. Pressing {{{kbd(C-u K)}}} in the agenda toggles this + variable. Lastly, pressing {{{kbd(K)}}} in the agenda buffer causes habits to temporarily be disabled and do not appear at all. Press {{{kbd(K)}}} diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index da5edee..8e07da4 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -152,7 +152,10 @@ LaTeX font locking. negative value as a valid repeater to shift time stamps in backward in cloned subtrees. You can give, for example, ā-3dā to shift three days in the past. - +*** Toggle display of all vs. undone scheduled habits conveniently +=<C-u K>= (~org-habit-toggle-display-in-agenda~) in an agenda toggles +the display of all habits to those which are undone and scheduled. +This is a function for convenience. ** New functions *** ~org-dynamic-block-insert-dblock~ @@ -164,6 +167,7 @@ dynamic block in ~org-dynamic-block-alist~. *** ~org-table-cell-down~ *** ~org-table-cell-left~ *** ~org-table-cell-right~ +*** ~org-habit-toggle-display-in-agenda~ ** Removed functions *** ~org-babel-set-current-result-hash~ diff --git a/lisp/org-habit.el b/lisp/org-habit.el index 2ef1b7a..939d7eb 100644 --- a/lisp/org-habit.el +++ b/lisp/org-habit.el @@ -449,7 +449,18 @@ current time." (message "Habits turned %s" (if org-habit-show-habits "on" "off"))) -(org-defkey org-agenda-mode-map "K" 'org-habit-toggle-habits) +(defun org-habit-toggle-display-in-agenda (arg) + "Toggle display of habits in agenda. +With ARG toggle display of all vs. undone scheduled habits. +See `org-habit-show-all-today'." + (interactive "P") + (if (not arg) + (org-habit-toggle-habits) + (org-agenda-check-type t 'agenda) + (setq org-habit-show-all-today (not org-habit-show-all-today)) + (when org-habit-show-habits (org-agenda-redo)))) + +(org-defkey org-agenda-mode-map "K" 'org-habit-toggle-display-in-agenda) (provide 'org-habit) |