mirror of
https://github.com/pestctrl/emacs-config.git
synced 2026-02-16 16:24:18 +00:00
Implemented custom delay
This commit is contained in:
parent
83dc9835aa
commit
ecdaef9860
6 changed files with 85 additions and 16 deletions
|
|
@ -604,8 +604,7 @@
|
|||
(todo "NEXT"))
|
||||
((org-ql-block-header "Things to do")))
|
||||
(agenda ""
|
||||
((org-agenda-skip-function 'my/agenda-custom-skip)
|
||||
(org-agenda-span 'day)
|
||||
((org-agenda-span 'day)
|
||||
(org-agenda-tag-filter-preset (quote (,dev-tag)))
|
||||
(org-agenda-skip-deadline-if-done t)
|
||||
(org-agenda-skip-scheduled-if-done t)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
(require 'org-loop)
|
||||
(require 'org-project)
|
||||
(require 'org-delay)
|
||||
|
||||
;; New stuff, may not stick around
|
||||
(require 'org-ql-custom-stuck-projects)
|
||||
|
|
|
|||
66
lisp/org-delay.el
Normal file
66
lisp/org-delay.el
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
;;; org-delay.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2019 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2019-12-19 16:52]
|
||||
|
||||
;; This file is not part of GNU Emacs
|
||||
|
||||
;; This program is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defun org-delay (arg &optional time)
|
||||
(interactive "P")
|
||||
(if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
|
||||
(error "Not supported yet")
|
||||
(pcase arg
|
||||
('(4)
|
||||
(org-entry-delete (point) "DELAYED"))
|
||||
(_
|
||||
(let ((new-time
|
||||
(or time
|
||||
(format "<%s>"
|
||||
(org-read-date
|
||||
nil nil nil
|
||||
"Delay until when?")))))
|
||||
(org-entry-put (point) "DELAYED" new-time))))))
|
||||
|
||||
(define-key org-mode-map (kbd "C-c <C-tab>") #'org-delay)
|
||||
|
||||
(defun org-agenda-delay (arg &optional time)
|
||||
(interactive "P")
|
||||
(org-agenda-check-type t 'agenda 'todo 'tags 'search)
|
||||
(org-agenda-check-no-diary)
|
||||
(let* ((marker (or (org-get-at-bol 'org-marker)
|
||||
(org-agenda-error)))
|
||||
(buffer (marker-buffer marker))
|
||||
(pos (marker-position marker))
|
||||
ts)
|
||||
(org-with-remote-undo buffer
|
||||
(with-current-buffer buffer
|
||||
(widen)
|
||||
(goto-char pos)
|
||||
(setq ts (org-delay arg time)))
|
||||
(org-agenda-show-new-time marker ts " D"))
|
||||
(message "%s" ts)))
|
||||
|
||||
(define-key org-agenda-mode-map (kbd "C-c <C-tab>") #'org-agenda-delay)
|
||||
|
||||
|
||||
(provide 'org-delay)
|
||||
;;; org-delay.el ends here
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
;;; org-project-projects.el --- -*- lexical-binding: t -*-
|
||||
;;; opr-projects.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2019Benson Chu
|
||||
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(require 'org-project-util)
|
||||
(require 'opr-util)
|
||||
|
||||
;; Context sensitive
|
||||
(define-todo-keyword "META" 'project :color "white" :key ?m)
|
||||
|
|
@ -80,9 +80,8 @@
|
|||
("ETERNAL" 'active)
|
||||
(t (when (or (not (member state opr/ambiguous))
|
||||
(eq 'project (opr/ambiguous-task-or-project)))
|
||||
(if (and (member state opr/strict-projects)
|
||||
(org-time> (org-entry-get (point) "SCHEDULED")
|
||||
(org-matcher-time "<now>")))
|
||||
(if (org-time> (org-entry-get (point) "DELAYED")
|
||||
(org-matcher-time "<now>"))
|
||||
'invis
|
||||
(pcase state
|
||||
("EMPTY" (empty-status?))
|
||||
|
|
@ -95,4 +94,4 @@
|
|||
(meta1-status?))))))))))
|
||||
|
||||
(provide 'opr-projects)
|
||||
;;; org-project-projects.el ends here
|
||||
;;; opr-projects.el ends here
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
;;; org-project-tasks.el --- -*- lexical-binding: t -*-
|
||||
;;; opr-tasks.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2019Benson Chu
|
||||
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(require 'org-project-util)
|
||||
(require 'opr-util)
|
||||
|
||||
(define-todo-keyword "STUFF" 'task :color "goldenrod" :key ?s)
|
||||
|
||||
|
|
@ -74,4 +74,4 @@
|
|||
'stuck))))))
|
||||
|
||||
(provide 'opr-tasks)
|
||||
;;; org-project-tasks.el ends here
|
||||
;;; opr-tasks.el ends here
|
||||
|
|
|
|||
|
|
@ -26,11 +26,12 @@
|
|||
|
||||
(require 'org)
|
||||
(require 'org-loop)
|
||||
(require 'org-project-legacy)
|
||||
(require 'pcase)
|
||||
(require 'org-delay)
|
||||
(require 'org-project-legacy)
|
||||
|
||||
;; Import init function, opr/strict-projects, opr/ambiguous, and opr/strict-task
|
||||
(load-file "./opr-util.el")
|
||||
(require 'opr-util)
|
||||
|
||||
(opr/init)
|
||||
|
||||
|
|
@ -94,7 +95,7 @@
|
|||
'task
|
||||
type)))
|
||||
|
||||
(defun opr/get-type-and-state ()
|
||||
(defun opr/get-type-and-state ()
|
||||
(let* ((state (org-get-todo-state))
|
||||
(type (cond ((member state opr/strict-projects)
|
||||
'project)
|
||||
|
|
@ -103,7 +104,7 @@
|
|||
((member state opr/ambiguous)
|
||||
(opr/ambiguous-task-or-project))
|
||||
(t 'legacy))))
|
||||
(list (if (eq 'legacy type)
|
||||
(cons (if (eq 'legacy type)
|
||||
'task
|
||||
type)
|
||||
(pcase type
|
||||
|
|
@ -113,7 +114,10 @@
|
|||
|
||||
(defun opr/print-type-and-state ()
|
||||
(interactive)
|
||||
(message "Headline has todo keyword \"%s\" and is \"%s\"" (opr/get-type)))
|
||||
(let ((ts (opr/get-type-and-state)))
|
||||
(message "Headline has todo keyword \"%s\" and is \"%s\""
|
||||
(car ts)
|
||||
(cdr ts))))
|
||||
|
||||
(provide 'org-project)
|
||||
;;; org-project.el ends here
|
||||
|
|
|
|||
Loading…
Reference in a new issue