add non-context filter

This commit is contained in:
petrucci4prez 2018-05-16 23:04:34 -04:00
parent 45b6a3a690
commit 4aef52dbb5
2 changed files with 38 additions and 6 deletions

22
conf.el
View File

@ -20,7 +20,9 @@
(setq scroll-conservatively 100) (setq scroll-conservatively 100)
(when window-system (global-prettify-symbols-mode t)) (add-hook 'ess-mode-hook #'prettify-symbols-mode)
(add-hook 'inferior-ess-mode-hook #'prettify-symbols-mode)
(add-hook 'prog-mode-hook #'prettify-symbols-mode)
(when window-system (global-hl-line-mode t)) (when window-system (global-hl-line-mode t))
@ -119,6 +121,7 @@
:delight :delight
:init :init
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode) (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(add-hook 'inferior-ess-mode-hook #'rainbow-delimiters-mode)
(add-hook 'ess-mode-hook #'rainbow-delimiters-mode)) (add-hook 'ess-mode-hook #'rainbow-delimiters-mode))
(use-package ace-window (use-package ace-window
@ -276,6 +279,7 @@
"M" 'org-agenda-month-view "M" 'org-agenda-month-view
"Y" 'org-agenda-year-view "Y" 'org-agenda-year-view
"ct" nil "ct" nil
"sC" 'nd/org-agenda-filter-non-context
"e" 'org-agenda-set-effort "e" 'org-agenda-set-effort
"ce" nil) "ce" nil)
@ -842,6 +846,18 @@ tags that do not have tags in neg-tags-list"
(org-agenda-redo)) (org-agenda-redo))
(message msg)) (message msg))
(defun nd/org-agenda-filter-non-context ()
"A quick and dirty agenda filter that removes all
tasks with context tags"
(interactive)
(let* ((tags-list (mapcar #'car org-tag-alist))
(context-tags (append
(nd/filter-list-prefix "@" tags-list)
(nd/filter-list-prefix "#" tags-list))))
(setq org-agenda-tag-filter
(mapcar (lambda(tag) (concat "-" tag)) context-tags))
(org-agenda-filter-apply org-agenda-tag-filter 'tag)))
(setq org-agenda-tags-todo-honor-ignore-options t) (setq org-agenda-tags-todo-honor-ignore-options t)
(setq org-agenda-prefix-format (setq org-agenda-prefix-format
@ -917,8 +933,8 @@ tags that do not have tags in neg-tags-list"
((tags "REFILE" ((tags "REFILE"
((org-agenda-overriding-header "Tasks to Refile")) ((org-agenda-overriding-header "Tasks to Refile"))
(org-tags-match-list-sublevels nil)) (org-tags-match-list-sublevels nil))
,(nd/agenda-base-task-command "-NA-REFILE/TODO|NEXT|WAIT" "Project Tasks Without Context" ''nd/skip-project-tasks-with-context) ,(nd/agenda-base-task-command "-NA-REFILE-%inc/TODO|NEXT|WAIT" "Project Tasks Without Context" ''nd/skip-project-tasks-with-context)
,(nd/agenda-base-task-command "-NA-REFILE/!" "Atomic Tasks Without Context" ''nd/skip-atomic-tasks-with-context) ,(nd/agenda-base-task-command "-NA-REFILE-%inc/!" "Atomic Tasks Without Context" ''nd/skip-atomic-tasks-with-context)
;; ,(nd/agenda-base-task-command "-NA-REFILE-%subdiv/TODO|NEXT|WAIT" "Tasks Without Effort" ''nd/skip-tasks-with-effort) ;; ,(nd/agenda-base-task-command "-NA-REFILE-%subdiv/TODO|NEXT|WAIT" "Tasks Without Effort" ''nd/skip-tasks-with-effort)
,(nd/agenda-base-task-command task-match "Discontinous Project" ''nd/skip-non-discontinuous-project-tasks) ,(nd/agenda-base-task-command task-match "Discontinous Project" ''nd/skip-non-discontinuous-project-tasks)
,(nd/agenda-base-project-command project-match "Invalid Todostate" :invalid-todostate))) ,(nd/agenda-base-project-command project-match "Invalid Todostate" :invalid-todostate)))

View File

@ -42,7 +42,9 @@ work in progress
#+END_SRC #+END_SRC
*** pretty symbols *** pretty symbols
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(when window-system (global-prettify-symbols-mode t)) (add-hook 'ess-mode-hook #'prettify-symbols-mode)
(add-hook 'inferior-ess-mode-hook #'prettify-symbols-mode)
(add-hook 'prog-mode-hook #'prettify-symbols-mode)
#+END_SRC #+END_SRC
*** highlight current line *** highlight current line
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -177,6 +179,7 @@ These are commands that should work in any mode. Make the assumption that functi
:delight :delight
:init :init
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode) (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(add-hook 'inferior-ess-mode-hook #'rainbow-delimiters-mode)
(add-hook 'ess-mode-hook #'rainbow-delimiters-mode)) (add-hook 'ess-mode-hook #'rainbow-delimiters-mode))
#+END_SRC #+END_SRC
** ace-window ** ace-window
@ -425,6 +428,7 @@ the fonts in org headings bug me, make them smaller and less invasive
"M" 'org-agenda-month-view "M" 'org-agenda-month-view
"Y" 'org-agenda-year-view "Y" 'org-agenda-year-view
"ct" nil "ct" nil
"sC" 'nd/org-agenda-filter-non-context
"e" 'org-agenda-set-effort "e" 'org-agenda-set-effort
"ce" nil) "ce" nil)
@ -1102,6 +1106,18 @@ Note that this is used for "normal" projects as well as iterators
(when (equal major-mode 'org-agenda-mode) (when (equal major-mode 'org-agenda-mode)
(org-agenda-redo)) (org-agenda-redo))
(message msg)) (message msg))
(defun nd/org-agenda-filter-non-context ()
"A quick and dirty agenda filter that removes all
tasks with context tags"
(interactive)
(let* ((tags-list (mapcar #'car org-tag-alist))
(context-tags (append
(nd/filter-list-prefix "@" tags-list)
(nd/filter-list-prefix "#" tags-list))))
(setq org-agenda-tag-filter
(mapcar (lambda(tag) (concat "-" tag)) context-tags))
(org-agenda-filter-apply org-agenda-tag-filter 'tag)))
#+END_SRC #+END_SRC
*** custom commands *** custom commands
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -1180,8 +1196,8 @@ Note that this is used for "normal" projects as well as iterators
((tags "REFILE" ((tags "REFILE"
((org-agenda-overriding-header "Tasks to Refile")) ((org-agenda-overriding-header "Tasks to Refile"))
(org-tags-match-list-sublevels nil)) (org-tags-match-list-sublevels nil))
,(nd/agenda-base-task-command "-NA-REFILE/TODO|NEXT|WAIT" "Project Tasks Without Context" ''nd/skip-project-tasks-with-context) ,(nd/agenda-base-task-command "-NA-REFILE-%inc/TODO|NEXT|WAIT" "Project Tasks Without Context" ''nd/skip-project-tasks-with-context)
,(nd/agenda-base-task-command "-NA-REFILE/!" "Atomic Tasks Without Context" ''nd/skip-atomic-tasks-with-context) ,(nd/agenda-base-task-command "-NA-REFILE-%inc/!" "Atomic Tasks Without Context" ''nd/skip-atomic-tasks-with-context)
;; ,(nd/agenda-base-task-command "-NA-REFILE-%subdiv/TODO|NEXT|WAIT" "Tasks Without Effort" ''nd/skip-tasks-with-effort) ;; ,(nd/agenda-base-task-command "-NA-REFILE-%subdiv/TODO|NEXT|WAIT" "Tasks Without Effort" ''nd/skip-tasks-with-effort)
,(nd/agenda-base-task-command task-match "Discontinous Project" ''nd/skip-non-discontinuous-project-tasks) ,(nd/agenda-base-task-command task-match "Discontinous Project" ''nd/skip-non-discontinuous-project-tasks)
,(nd/agenda-base-project-command project-match "Invalid Todostate" :invalid-todostate))) ,(nd/agenda-base-project-command project-match "Invalid Todostate" :invalid-todostate)))