From: stardiviner <numbchild@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: numbchild@gmail.com, emacs-devel@gnu.org
Subject: Re: [BUG] ov property line height failed on lone length line when exceeded window width
Date: Thu, 04 Jun 2020 23:46:09 +0800 [thread overview]
Message-ID: <87v9k6esvy.fsf@gmail.com> (raw)
In-Reply-To: <83wo4nas3n.fsf@gnu.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Eli Zaretskii <eliz@gnu.org> writes:
>> From: stardiviner <numbchild@gmail.com>
>> Cc: emacs-devel@gnu.org
>> Date: Thu, 04 Jun 2020 08:43:27 +0800
>>
>> > In that case, this is the expected behavior: if the newline with the
>> > line-height property is not visible, the setting has no effect. It is
>> > conceptually the same as having a tall character or image displayed on
>> > a line: if you then truncate the line so that the tall element is not
>> > visible, the line's height will be decreased to reflect what is
>> > actually on display.
>>
>> I have a little kind of understand. Hmm, is there any workaround of this
>> situation? I want it to be displayed anyway. Change my code, or toggle some
>> options or something else?
>
> Can you describe what are you trying to accomplish, and for what
> purpose? Maybe then we could propose a workaround.
I try to add overlay which is colorized blocks that have line-height based on
the org-agenda clocked time.
I hope the overlay can keep line-height even I split window get window width
decreased.
The core code is here:
#+begin_src emacs-lisp
;; Show Org Agenda tasks with heigh spacing based on clock time with `org-agenda-log-mode'.
;; work with org-agenda dispatcher [c] "Today Clocked Tasks" to view today's clocked tasks.
(defun org-agenda-clock-colorize-block ()
"Set different line spacing based on clock time duration."
(save-excursion
(let* ((colors (cl-case (alist-get 'background-mode (frame-parameters))
('light
(list "#F6B1C3" "#FFFF9D" "#BEEB9F" "#ADD5F7"))
('dark
(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-clock-colorize-block)
#+end_src
Which I get this code originally from this URL
https://emacs-china.org/t/org-agenda/8679 (It's Chinese Emacs forum).
- --
[ stardiviner ]
I try to make every word tell the meaning that I want to express.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
-----BEGIN PGP SIGNATURE-----
iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl7ZF0EUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsOY+gf+JfnwA67k3RpnSXcIaERYDALF434Q
t2XpigdnMigV3T+6OwQoPXHEPvmZU0tQ2a/RcPhMRw70FbQP2KGKqwc5VnSonzyp
NBYKKBKWoQtNpFFdK7Nu1sL+5/7weLtK0IH4DjZ7whp5POj32l+AAD8FTclOJLIn
CezOj/X5YsGmh08eUEIjUK9mk229hun9UFV4emdNj8BDisNXQQELyrOTXF3ITiZC
+peQmYWib90G+Pma4AavW9EyfxOoZVgOf846M5e8MMyrhLXaGKzJh7eyRab26psA
mTS8vOOGzFPyK0SisHU0I3T+JsvdJRScZfFZNWJZvQyPP03pvxEImod0Og==
=cFd8
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2020-06-04 15:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-03 10:23 [BUG] ov property line height failed on lone length line when exceeded window width numbchild
2020-06-03 11:07 ` Eli Zaretskii
[not found] ` <CAL1eYuJ0_rTgUr3bimtQHcX3fPG72sdhU53h9kkZ_jbiLaNpaA@mail.gmail.com>
2020-06-03 14:43 ` Eli Zaretskii
2020-06-04 0:43 ` stardiviner
2020-06-04 13:16 ` Eli Zaretskii
2020-06-04 15:46 ` stardiviner [this message]
2020-06-05 11:58 ` Eli Zaretskii
2020-06-05 15:59 ` stardiviner
2021-01-27 13:59 ` Christopher Miles
2021-01-27 14:34 ` [FEATURE SUGGESTED] " Christopher Miles
2021-01-30 9:08 ` Eli Zaretskii
2021-01-30 12:15 ` Christopher Miles
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v9k6esvy.fsf@gmail.com \
--to=numbchild@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@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.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).