From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id wGpTGAr/YF90SwAA0tVLHw (envelope-from ) for ; Tue, 15 Sep 2020 17:51:06 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id CLymEgr/YF/wbwAA1q6Kng (envelope-from ) for ; Tue, 15 Sep 2020 17:51:06 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D4AAB9403C5 for ; Tue, 15 Sep 2020 17:51:05 +0000 (UTC) Received: from localhost ([::1]:33722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIF6e-0007BV-L1 for larch@yhetil.org; Tue, 15 Sep 2020 13:51:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIEx3-000476-Ck for emacs-orgmode@gnu.org; Tue, 15 Sep 2020 13:41:09 -0400 Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f]:43667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kIEx1-0006SX-5f for emacs-orgmode@gnu.org; Tue, 15 Sep 2020 13:41:09 -0400 Received: by mail-qt1-x82f.google.com with SMTP id g3so3813371qtq.10 for ; Tue, 15 Sep 2020 10:41:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version:content-transfer-encoding; bh=DvdS1Ohuzo36K662MNVGIiU3so+UlmKGwmkGPju1FZU=; b=ufG75mYbYzAECqVd0ekIBjnfDD3od2bRzHHqAzmb1pJFmEuCeyajF8oFPS6SeRZru6 zLnPmqOsRDSvQdIM8Ohv2amBReDZ3tCpF0EA/cVhz/1BHJXcw5OQDI71+lNt+GAI4uN6 dhmAdnmD3FMgnqR77at8V6exvI+sNOYKq2ExX0phrxxwE5+mtbl9wmsc/VtGgx87cPxN XWnIDKz5/tW0QK4GLZcat0saAHw/X8mDKFVPzSYMFa1/MX+jRpDTlJQ5dEuHxYsiCEqo MtIY3HY3FJoZohOIqwN3SGnAjWyfZDm3zbI11mb0HOmRhiSokqc2jMo0cSZvCYW4v7Bo HC0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version:content-transfer-encoding; bh=DvdS1Ohuzo36K662MNVGIiU3so+UlmKGwmkGPju1FZU=; b=SMngzXubrSr+YRWThwVQx44ErDihGXpeqaz3aqKq2TQ1gDaeUxcGacipOPHb16h8DV +dDkdZiJrrUi5J0uCdc0sMzuzjp7GT/bokmK6aT6mnilAjBo9L7qYtDIV6UF5aXh/IAT oJpYx9VANHsUhfnSpC/RHuH6qi7ljpOyIdT9O0WX3ntqnze3B+lwmA3FK/WDqeaT2Xqs YixgMdN8Ze3uS5i+ZudapKnithE6lYqEkpFqHd/pzoZtaZ78zyesK0Tptebz3KABx+j7 Vmc1VbXlD9HbNd47mqK+/v4G5g93JUcvOQXWbR7i89KjHh10yk70y8j+z0Vi4OhyaJR0 VuEA== X-Gm-Message-State: AOAM531Hxtg+lBm5u+Z6D1qFpuFGqz2gp5uEtNtCW4L6m0xP2tJTnIbd UOeJKIB0Y7z1yqqIWlU5/00= X-Google-Smtp-Source: ABdhPJwIq2Uh93wSFVgZRnVgqUDdACCdBFBPH9NZgmcXDhY+Nz1F3Xw15g3xlimC7g5SArq2BnWFVg== X-Received: by 2002:aed:3e2e:: with SMTP id l43mr19996617qtf.392.1600191665641; Tue, 15 Sep 2020 10:41:05 -0700 (PDT) Received: from jtop (c-76-20-248-106.hsd1.ga.comcast.net. [76.20.248.106]) by smtp.gmail.com with ESMTPSA id v131sm17725418qkb.15.2020.09.15.10.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2020 10:41:04 -0700 (PDT) References: <87wo1483r5.fsf@protesilaos.com> <87v9gnl4on.fsf@gnu.org> <87mu1znrf1.fsf@ucl.ac.uk> <87eenbj9p2.fsf@gnu.org> User-agent: mu4e 1.2.0; emacs 28.0.50 From: Jeff Filipovits To: emacs-orgmode@gnu.org Subject: Re: variable-pitch-mode misaligns org-mode heading tags In-reply-to: <87eenbj9p2.fsf@gnu.org> Date: Tue, 15 Sep 2020 13:41:04 -0400 Message-ID: <878sdblyz3.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::82f; envelope-from=jrfilipovits@gmail.com; helo=mail-qt1-x82f.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Protesilaos Stavrou , Eric S Fraga Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=ufG75mYb; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: fZta49F37a/h Following the call for help to fix bugs, and with building guilt,=20 I=E2=80=99ve taken a stab at fixing aligning tags when using a=20 variable-pitch font. I haven=E2=80=99t tested this much because I do not=20 know if it is misguided, but it seems to work. Seems the only way to do it is to use the =E2=80=98display text property=20 and expand a single space between the headline and tags. Here is a=20 drop-in replacement of org--align-tags-here which ensures there is=20 one space between the tags and headline, and then expands that=20 space by setting a text property. I=E2=80=99ve removed the point-preserving code because it does not seem to= =20 be needed using this method. This would also allow removing=20 org-fix-tags-on-the-fly from org-self-insert-command since there=20 is only a single space between the headline and the tags and it is=20 adjusted automatically.=20 If this looks promising I can throw some more time at it. If not,=20 I will happily abandon it.=20 (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 tags." (save-excursion=20 (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") (point)))) ;; If there is more than one space between the headline=20 and tags, ;; delete the extra spaces. Might be better to ;; make the delete region one space smaller rather than=20 inserting ;; a new space? (when (> tags-start (1+ blank-start)) (delete-region blank-start tags-start) (goto-char blank-start) (insert " ")) ;; Don't set the text property unless it is needed. ;; Not sure this check is efficient. Probably not=20 necessary. (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=20 ,to-col)))))))) Bastien writes: > Hi Eric, > > Eric S Fraga writes: > >> Also support for org-indent-mode: having the text align nicely=20 >> with the >> heading (as it does with monospace typefaces) would be more=20 >> visually >> pleasing. >> >> But I have a feeling that the calculations required for this=20 >> and the >> above may be significant and arguably not worth it?=20=20 > > Indeed. > >> Org, especially >> with respect to (large) tables, is already quite slow=20 >> unfortunately. > > Fortunately, the reasons why tables might be slow are distinct=20 > from > the reasons why org-indent might be slow.=20=20 > > But yes, space-based alignment is a welcome improvement as long=20 > as it > does not make Org slower. --=20 Jeff Filipovits Spears & Filipovits, LLC 1126 Ponce de Leon Avenue Atlanta, GA 30306 678.237.9302 (direct) jrfilipovits@gmail.com All emails confidential to the fullest extent of the law.