From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: [PATCH] support colorful blocks display on org-agenda Date: Wed, 12 Feb 2020 16:34:24 +0800 Message-ID: <87mu9ow6en.fsf@gmail.com> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:37569) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1nTq-00008Z-KM for emacs-orgmode@gnu.org; Wed, 12 Feb 2020 03:34:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1nTo-0001cs-Af for emacs-orgmode@gnu.org; Wed, 12 Feb 2020 03:34:46 -0500 Received: from [112.17.247.90] (port=61797 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j1nTe-0001TR-ES for emacs-orgmode@gnu.org; Wed, 12 Feb 2020 03:34:44 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: Org Mode =2D----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-a= genda-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" "DarkSlateBl= ue")) 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. =2D --=20 [ 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 =20=20=20=20=20=20 =2D----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=3D=3D =3DmhYR =2D----END PGP SIGNATURE-----