emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: prettify-symbols-mode in org agenda?


From: Bastien
Subject: Re: prettify-symbols-mode in org agenda?
Date: Mon, 03 May 2021 19:16:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]