[Top][All Lists]

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

Re: variable-pitch-mode misaligns org-mode heading tags

From: Jeff Filipovits
Subject: Re: variable-pitch-mode misaligns org-mode heading tags
Date: Wed, 16 Sep 2020 15:03:02 -0400
User-agent: mu4e 1.2.0; emacs 28.0.50


Thanks. You are right of course and I realized the right-align issue right after I sent my email.
Adam Spiers <orgmode@adamspiers.org> writes:

But the whole point of this exercise is to support variable-width fonts. In this case, the correct position for the end of the single space is most likely not even a multiple of the fixed column width, so
it would probably need to be measured in pixels rather than
columns. And in order to calculate it, it is first necessary to
calculate the exact width in pixels of the colon-delimited list of tags. As I mentioned in the comment linked above, I searched for a way of calculating the pixel width of the tag list, and the best I could
find was `pos-visible-in-window-p' which has some issues which I
mentioned there. If you have thoughts on whether I'm right about
those, and if so how to solve them, I'd love to hear! Cheers,

It looks like (window-text-pixel-size) could be used to calculate the pixel length of the tags list? I am having trouble deciphering the manual (https://www.gnu.org/software/emacs/manual/html_node/elisp/Pixel-Specification.html#Pixel-Specification) for pixel specification for spaces, though. The right alignment specification for some reason sends the tags to the next line, as do most other solutions that I would expect to align the text to the right side of the window. I can experiment more in a couple days, but in the meantime maybe someone smarter than me give some hints on how to use the pixel specification properties.
BTW I tried your code and for some reason it didn't insert any space
for me, but I didn't look into that yet.

The way it’s written it would only reduce the gap between the headline and tags to a space, and it assumes there are multiple spaces there already. If there’s no space between the two, I don’t think it’ll insert one. Probably not the best way as it was thrown together to test the text property fix. I accepted long ago that the solution to using a variable pitch font for org headings was that the tags would not be aligned to the right and never looked back, so maybe this is not worth the price of fixing it if it is messy. And diving down to calculating the pixel width of text seems like it’s getting pretty messy.
Jeff Filipovits
Spears & Filipovits, LLC
1126 Ponce de Leon Avenue
Atlanta, GA 30306
678.237.9302 (direct)

All emails confidential to the fullest extent of the law.

reply via email to

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