From: Bastien <bzg@gnu.org>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: William Xu <william.xwl@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: prettify-symbols-mode in org agenda?
Date: Mon, 03 May 2021 19:16:44 +0200 [thread overview]
Message-ID: <87k0ofn3er.fsf@gnu.org> (raw)
In-Reply-To: <87h7jl1eds.fsf@localhost> (Ihor Radchenko's message of "Sun, 02 May 2021 20:58:23 +0800")
Hi Ihor,
Ihor Radchenko <yantar92@gmail.com> writes:
> William Xu <william.xwl@gmail.com> writes:
>
>> Now I try to test it extensively. Even with all your changes, I find
>> when I use org-agenda-todo to change the todo-state inside the agenda
>> buffer, the new state isn't always prettified.
>>
>> Do you see the same behaviour?
>
> Oops. Yes, I do see the same behaviour. I only did light testing on
> master and I had some unrelated changes nullifying the problem you
> observe on my testing branch.
Thank you very much for the patch.
Could it slow down agenda generation for some configurations?
> See the updated patch.
>
> From 06a2d8ab328721835866bf97f0344cce15cd1dee Mon Sep 17 00:00:00 2001
> Message-Id: <06a2d8ab328721835866bf97f0344cce15cd1dee.1619960107.git.yantar92@gmail.com>
> From: Ihor Radchenko <yantar92@gmail.com>
> Date: Sat, 1 May 2021 20:09:10 +0800
> Subject: [PATCH] Make sure that fontification is preserved in agenda
>
> Preserve fontification and composition of headlines and tags in
> agenda. If the headlines/tags are not yet fontified when building
> agenda, make sure that they are fontified in the original Org mode
> buffers first.
>
> In addition, tags alignment is now done pixelwise to avoid alignment
> issues with variable-pitch symbols that may appear in fontified Org
> mode buffers. The alignment is utilising :align-to specification,
> which means that the alignment will be automatically updated as the
> agenda buffer is resized.
Please move the comments after the change log themselves.
> * lisp/org-macs.el (org-string-width): Refactor old code and add
> optional argument to return pixel width. The old code used manual
> parsing of text proerpties to find which parts of string are visible.
> The new code defers this work to Emacs display engine via
> `window-text-pixel-size'. The visibility settings of current buffer
> are taken into account.
>
> (org-buffer-substring-fontified): New function getting fontified
> substring from current buffer.
>
> * lisp/org-agenda.el (org-agenda-get-todos, org-agenda-get-progress,
> org-agenda-get-deadlines, org-agenda-get-scheduled): Use
> org-buffer-substring-fontified to get fontified heading.
>
> (org-agenda-fix-displayed-tags): Fontify tags.
>
> (org-agenda-highlight-todo): Preserve composition property used,
> i.e. by `prettify-symbols-mode'. The composition is usually set to be
> removed on text change, so we do the changes inside
> `with-silent-modifications'.
>
> (org-agenda-align-tags): Use pixel width and (space . :align-to)
> 'display property to align tags in agenda.
>
> * lisp/org.el (org-get-heading): Make sure that heading is fontified.
> ---
> lisp/org-agenda.el | 63 ++++++++++++++++----------
> lisp/org-macs.el | 108 ++++++++++++++++++---------------------------
> lisp/org.el | 2 +
> 3 files changed, 85 insertions(+), 88 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index bd9d466a6..5add0e092 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -5562,7 +5562,7 @@ (defun org-agenda-get-todos ()
> ts-date-pair (org-agenda-entry-get-agenda-timestamp (point))
> ts-date (car ts-date-pair)
> ts-date-type (cdr ts-date-pair)
> - txt (org-trim (buffer-substring (match-beginning 2) (match-end 0)))
> + txt (org-trim (org-buffer-substring-fontified (match-beginning 2) (match-end 0)))
Here and for the rest of the patch: please try to keep lines below 80
characters. I'm aware this is not always feasible, especially given
long functions with many nested s-exps, but let's try to come as close
as possible to 80.
Thanks!
--
Bastien
next prev parent reply other threads:[~2021-05-03 17:48 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-31 12:11 prettify-symbols-mode in org agenda? William Xu
2020-11-03 5:05 ` Ihor Radchenko
2020-11-03 19:05 ` William Xu
2020-11-04 1:47 ` Ihor Radchenko
2021-04-27 20:53 ` Bastien
2021-05-01 12:33 ` Ihor Radchenko
2021-05-01 13:33 ` William Xu
2021-05-01 14:37 ` Ihor Radchenko
2021-05-02 12:31 ` William Xu
2021-05-02 12:58 ` Ihor Radchenko
2021-05-02 13:56 ` William Xu
2021-05-03 17:16 ` Bastien [this message]
2021-05-04 4:23 ` Ihor Radchenko
2021-05-04 14:51 ` Ihor Radchenko
2021-05-05 15:23 ` Ihor Radchenko
2021-05-05 18:01 ` William Xu
2021-05-06 2:15 ` Ihor Radchenko
2021-05-14 15:35 ` William Xu
2021-05-15 12:15 ` Ihor Radchenko
2021-05-16 9:49 ` William Xu
2021-05-17 14:04 ` Ihor Radchenko
2021-05-17 17:44 ` William Xu
2021-06-20 11:27 ` Ihor Radchenko
2021-06-22 15:25 ` William Xu
2021-06-22 15:42 ` Ihor Radchenko
2021-06-22 18:07 ` William Xu
2021-07-02 14:11 ` Ihor Radchenko
2021-07-01 15:49 ` Timothy
2021-07-02 14:13 ` Ihor Radchenko
2021-10-26 9:03 ` William Xu
2021-10-27 6:50 ` Ihor Radchenko
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=87k0ofn3er.fsf@gnu.org \
--to=bzg@gnu.org \
--cc=emacs-orgmode@gnu.org \
--cc=william.xwl@gmail.com \
--cc=yantar92@gmail.com \
/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.