From: Jeff Filipovits <email@example.com>
Cc: Protesilaos Stavrou <firstname.lastname@example.org>,
Eric S Fraga <email@example.com>
Subject: Re: variable-pitch-mode misaligns org-mode heading tags
Date: Tue, 15 Sep 2020 13:41:04 -0400 [thread overview]
Message-ID: <firstname.lastname@example.org> (raw)
Following the call for help to fix bugs, and with building guilt,
I’ve taken a stab at fixing aligning tags when using a
variable-pitch font. I haven’t tested this much because I do not
know if it is misguided, but it seems to work.
Seems the only way to do it is to use the ‘display text property
and expand a single space between the headline and tags. Here is a
drop-in replacement of org--align-tags-here which ensures there is
one space between the tags and headline, and then expands that
space by setting a text property.
I’ve removed the point-preserving code because it does not seem to
be needed using this method. This would also allow removing
org-fix-tags-on-the-fly from org-self-insert-command since there
is only a single space between the headline and the tags and it is
If this looks promising I can throw some more time at it. If not,
I will happily abandon it.
(defun org--align-tags-here (to-col)
"Align tags on the current headline to TO-COL.
Assume point is on a headline. Preserve point when aligning
(when (org-match-line org-tag-line-re)
(let* ((tags-start (match-beginning 1))
(blank-start (progn (goto-char tags-start)
(skip-chars-backward " \t")
;; If there is more than one space between the headline
;; delete the extra spaces. Might be better to
;; make the delete region one space smaller rather than
;; a new space?
(when (> tags-start (1+ blank-start))
(delete-region blank-start tags-start)
(insert " "))
;; Don't set the text property unless it is needed.
;; Not sure this check is efficient. Probably not
(unless (equal (get-text-property blank-start 'display)
`(space . (:align-to ,to-col)))
(put-text-property blank-start (1+ blank-start)
'display `(space . (:align-to
Bastien <email@example.com> writes:
> Hi Eric,
> Eric S Fraga <firstname.lastname@example.org> writes:
>> Also support for org-indent-mode: having the text align nicely
>> with the
>> heading (as it does with monospace typefaces) would be more
>> But I have a feeling that the calculations required for this
>> and the
>> above may be significant and arguably not worth it?
>> Org, especially
>> with respect to (large) tables, is already quite slow
> Fortunately, the reasons why tables might be slow are distinct
> the reasons why org-indent might be slow.
> But yes, space-based alignment is a welcome improvement as long
> as it
> does not make Org slower.
Spears & Filipovits, LLC
1126 Ponce de Leon Avenue
Atlanta, GA 30306
All emails confidential to the fullest extent of the law.
next prev parent reply other threads:[~2020-09-15 17:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 19:31 variable-pitch-mode misaligns org-mode heading tags Protesilaos Stavrou
2020-09-09 8:44 ` Bastien
2020-09-09 11:03 ` Eric S Fraga
2020-09-09 14:39 ` Bastien
2020-09-15 17:41 ` Jeff Filipovits [this message]
2020-09-16 16:21 ` Adam Spiers
2020-09-16 19:03 ` Jeff Filipovits
2020-09-16 21:14 ` Samuel Wales
2020-09-16 22:55 ` Adam Spiers
2020-09-17 0:18 ` Adam Spiers
2020-09-17 2:03 ` Jeff Filipovits
2020-09-17 15:36 ` Jeff Filipovits
2020-09-18 12:49 ` Ihor Radchenko
2021-04-27 19:41 ` Bastien
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:
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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
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).