From: Yuri Lensky <ydl@ydl.cm>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: [Patch] Support for dimming local to each agenda
Date: Tue, 11 Jul 2017 17:39:59 -0700 [thread overview]
Message-ID: <CAC38U-cThtaELpmhUefQHtkjvDdcWyhP8vpsn_YiWMdj6ORJdQ@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 73 bytes --]
Composite agenda views can now set org-agenda-dim-blocked-tasks locally.
[-- Attachment #1.2: Type: text/html, Size: 96 bytes --]
[-- Attachment #2: 0002-org-agenda.el-Support-for-dimming-local-to-each-agen.patch --]
[-- Type: application/octet-stream, Size: 3839 bytes --]
From 52f8bf79a198fa2e7f131c2a015a7c9400a403ac Mon Sep 17 00:00:00 2001
From: "Yuri D. Lensky" <ydlensky@gmail.com>
Date: Mon, 10 Jul 2017 19:21:39 -0700
Subject: [PATCH 2/2] org-agenda.el: Support for dimming local to each agenda.
Composite agenda views could not separately specify whether to dim
blocked tasks.
---
lisp/org-agenda.el | 56 ++++++++++++++++++++++++++++++++++--------------------
1 file changed, 35 insertions(+), 21 deletions(-)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 9ac4f65..f132420 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3887,34 +3887,46 @@ dimming them."
(delete-overlay o)))
(save-excursion
(let ((inhibit-read-only t)
- (org-depend-tag-blocked nil)
- org-blocked-by-checkboxes)
+ (org-depend-tag-blocked nil))
(goto-char (point-min))
(while (let ((pos (text-property-not-all
- (point) (point-max) 'todo-state nil)))
+ (point) (point-max) 'org-todo-blocked nil)))
(when pos (goto-char pos)))
- (setq org-blocked-by-checkboxes nil)
- (let ((marker (org-get-at-bol 'org-hd-marker)))
- (when (and (markerp marker)
- (with-current-buffer (marker-buffer marker)
- (save-excursion (goto-char marker)
- (org-entry-blocked-p))))
- ;; Entries blocked by checkboxes cannot be made invisible.
- ;; See `org-agenda-dim-blocked-tasks' for details.
- (let* ((really-invisible
- (and (not org-blocked-by-checkboxes)
- (or invisible (eq org-agenda-dim-blocked-tasks
- 'invisible))))
- (ov (make-overlay (if really-invisible (line-end-position 0)
- (line-beginning-position))
- (line-end-position))))
- (if really-invisible (overlay-put ov 'invisible t)
- (overlay-put ov 'face 'org-agenda-dimmed-todo-face))
- (overlay-put ov 'org-type 'org-blocked-todo))))
+ (let* ((invisible (eq (org-get-at-bol 'org-todo-blocked) 'invisible))
+ (ov (make-overlay (if invisible
+ (line-end-position 0)
+ (line-beginning-position))
+ (line-end-position))))
+ (if invisible
+ (overlay-put ov 'invisible t)
+ (overlay-put ov 'face 'org-agenda-dimmed-todo-face))
+ (overlay-put ov 'org-type 'org-blocked-todo))
(forward-line))))
(when (called-interactively-p 'interactive)
(message "Dim or hide blocked tasks...done")))
+(defun org-agenda-mark-blocked-entry (entry)
+ "Mark a blocked entry in text properties."
+ (when (get-text-property 0 'todo-state entry)
+ (let ((entry-marker (get-text-property 0 'org-hd-marker entry))
+ (org-blocked-by-checkboxes nil)
+ ;; Necessary so that org-entry-blocked-p does not change the buffer
+ (org-depend-tag-blocked nil))
+ (let ((blocked
+ (with-current-buffer (marker-buffer entry-marker)
+ (save-mark-and-excursion
+ (goto-char entry-marker)
+ (org-entry-blocked-p)))))
+ (when blocked
+ (let ((really-invisible
+ (and (not org-blocked-by-checkboxes)
+ (eq org-agenda-dim-blocked-tasks 'invisible))))
+ (put-text-property
+ 0 (length entry) 'org-todo-blocked
+ (if really-invisible 'invisible t)
+ entry)))))
+ entry))
+
(defvar org-agenda-skip-function nil
"Function to be called at each match during agenda construction.
If this function returns nil, the current match should not be skipped.
@@ -6781,6 +6793,8 @@ The optional argument TYPE tells the agenda type."
(setq list (org-agenda-limit-entries list 'tags max-tags)))
(when max-entries
(setq list (org-agenda-limit-entries list 'org-hd-marker max-entries)))
+ (when (and org-agenda-dim-blocked-tasks org-blocker-hook)
+ (setq list (mapcar 'org-agenda-mark-blocked-entry list)))
(mapconcat 'identity list "\n")))
(defun org-agenda-limit-entries (list prop limit &optional fn)
--
2.9.2.windows.1
next reply other threads:[~2017-07-12 0:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-12 0:39 Yuri Lensky [this message]
2017-07-13 12:51 ` [Patch] Support for dimming local to each agenda Nicolas Goaziou
2017-07-13 18:09 ` Yuri Lensky
2017-07-14 8:29 ` Nicolas Goaziou
2017-07-14 9:22 ` Yuri Lensky
2017-07-14 9:39 ` Nicolas Goaziou
2017-07-14 12:18 ` Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAC38U-cThtaELpmhUefQHtkjvDdcWyhP8vpsn_YiWMdj6ORJdQ@mail.gmail.com \
--to=ydl@ydl.cm \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.