From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [PATCH] org: Fix tag width calculation for multi-column chars Date: Wed, 01 Jun 2016 16:27:54 +0200 Message-ID: <874m9dq905.fsf@gmx.us> References: <87wpmar7b4.wl@dns1.atmark-techno.com> <87k2iaknbh.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b877z-0006XE-Sr for emacs-orgmode@gnu.org; Wed, 01 Jun 2016 10:28:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b877t-0001pk-Sp for emacs-orgmode@gnu.org; Wed, 01 Jun 2016 10:28:10 -0400 Received: from plane.gmane.org ([80.91.229.3]:58376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b877t-0001pg-Kn for emacs-orgmode@gnu.org; Wed, 01 Jun 2016 10:28:05 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1b877s-0002o6-2l for emacs-orgmode@gnu.org; Wed, 01 Jun 2016 16:28:04 +0200 Received: from 46.166.188.244 ([46.166.188.244]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Jun 2016 16:28:04 +0200 Received: from rasmus by 46.166.188.244 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Jun 2016 16:28:04 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Samuel Wales writes: > i wonder if this also fixes tags for variable pitch (proportional) > fonts. i have been having great success with variable pitch fonts and > it would be great if this fixes tags for them too. No. https://www.gnu.org/software/emacs/manual/html_node/elisp/Size-of-Displayed-Text.html You'd need pixel alignment. Here’s a version that aligns the left part pf tags. (defun org-align-tags-here (&optional arg) ;; Assumes that this is a headline "Align tags on the current headline to TO-COL." (save-excursion (when (org-at-heading-p) (beginning-of-line) (re-search-forward org-complex-heading-regexp (line-end-position) t) (when (match-end 5) ; There’s a tag. (goto-char (match-end 4)) (delete-region (point) (match-beginning 5)) (insert (propertize (make-string (- (abs org-tags-column) (current-column) (- (match-end 5) (match-beginning 5))) ?\s) ;; one would need somehow intelligently figure out ;; the maximum pixel number. 'display '(space :align-to (600)))))))) Questions if we were to pixel align: - Can we drop right alignment of tags? (i.e. org-tags-column < 0). - We might need to know the pixel width of :tags: anyway to set the width of the white space to "right-margin" - "width-of-tags". Is this robust to resizing? Or is there a "\hfill"-like property for Emacs space? - How to determine max width on "auto-filled" file? Go through each line or just make it a custom value? Perhaps a nice "conservative" way is to introduce a org-tags-column-pixel, but if we can find a good "automatic" way that’s nicer IMO. Rasmus -- The second rule of Fight Club is: You do not talk about Fight Club