From: stardiviner <numbchild@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] support colorful blocks display on org-agenda
Date: Wed, 12 Feb 2020 16:34:24 +0800 [thread overview]
Message-ID: <87mu9ow6en.fsf@gmail.com> (raw)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
I have got author's permission to add this patch to Org Mode.
Here is the original thread: https://emacs-china.org/t/org-agenda/8679/8
I don't know whether this patch have to get author signed FSF papers. Might have
not exceeded the TINYCHANGE limit?
Here is the patch code.
#+begin_src emacs-lisp
;; Show Org Agenda tasks with heigh spacing based on clock time with `org-agenda-log-mode'.
;; https://emacs-china.org/t/org-agenda/8679
;; work with org-agenda dispatcher [c] "Today Clocked Tasks" to view today's clocked tasks.
(defun org-agenda-time-grid-colorful-spacing ()
"Set different line spacing w.r.t. time duration."
(save-excursion
;; (list "#aa557f" "DarkGreen" "DarkSlateGray" "DarkSlateBlue") ; dark theme
;; (list "#F6B1C3" "#FFFF9D" "#BEEB9F" "#ADD5F7") ; white theme
(let* ((colors (list "#aa557f" "DarkGreen" "DarkSlateGray" "DarkSlateBlue"))
pos
duration)
(nconc colors colors)
(goto-char (point-min))
(while (setq pos (next-single-property-change (point) 'duration))
(goto-char pos)
(when (and (not (equal pos (point-at-eol)))
(setq duration (org-get-at-bol 'duration)))
;; larger duration bar height
(let ((line-height (if (< duration 15) 1.0 (+ 0.5 (/ duration 30))))
(ov (make-overlay (point-at-bol) (1+ (point-at-eol)))))
(overlay-put ov 'face `(:background ,(car colors) :foreground "black"))
(setq colors (cdr colors))
(overlay-put ov 'line-height line-height)
(overlay-put ov 'line-spacing (1- line-height))))))))
(add-hook 'org-agenda-finalize-hook #'org-agenda-time-grid-colorful-spacing)
#+end_src
If this patch can be merged. I will submit an PATCH format file.
BTW, about this patch, I know using hook is a user hack way. In real patch, I
will add a defcustom option to enabled by default (WDYT?). and loaded in
org-agenda finalize position.
- --
[ stardiviner ]
I try to make every word tell the meaning what I want to express.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
-----BEGIN PGP SIGNATURE-----
iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5DuJEUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsM8Qwf+MFGcBeC180m7fN/PLwrkeuOMS5zT
XsR3oS2B/urrPY8DU2+Ff3YgA+HABFpJ0O0DHe5O+xdFr0uggJhFJi3wqPXetl4e
i+IKGx3j8gJ2cpSf1E5CATWppCklMEX4aFB7hk35zRtrIsn+Kgs5irr1EPxAmqjY
0CyvklRe3RacPSDRNh6PTPYJPmYa3UIgjkD6kzzSxB+ED6xTECDwuh9dSMQhqj1q
8+/ji9OfYjyFzHkdEC8+fc+e2wZ7/lm4sGUfW6Y3v5KIonhtrA+D/tikGfqHvfR2
Q728uZGGQcrYO511V37f+bAndW2GSSaAIZJ5gzcatqB+wRnqTcqMlQSiHw==
=mhYR
-----END PGP SIGNATURE-----
next reply other threads:[~2020-02-12 8:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-12 8:34 stardiviner [this message]
2020-02-12 8:40 ` [PATCH] support colorful blocks display on org-agenda Bastien
2020-02-20 7:01 ` stardiviner
2020-02-20 7:15 ` Bastien
2020-02-20 15:17 ` stardiviner
2020-02-23 22:18 ` Daniele Nicolodi
2020-02-12 8:42 ` Bastien
2020-02-12 10:37 ` stardiviner
2020-02-20 15:34 ` [SOLVED] " stardiviner
2020-02-20 15:41 ` Bastien
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mu9ow6en.fsf@gmail.com \
--to=numbchild@gmail.com \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).