From 11058a713a3179e47ae24a583b2bf981b4a694b7 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Wed, 19 May 2010 11:34:23 +0200 Subject: [PATCH] Fix alignment of numbers with invisible characters in tables Bold numbers like *2.4* were aligned incorrectly in columns that have mostly numbers. Reported by Sebastian Rose --- lisp/ChangeLog | 5 +++++ lisp/org-table.el | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7cc28e451..5640c492e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-05-19 Carsten Dominik + + * org-table.el (org-table-align): Fix alignment of strings + with invisible characters. + 2010-05-17 Carsten Dominik * org.el (org-refile-use-cache): New option. diff --git a/lisp/org-table.el b/lisp/org-table.el index 1763b54bf..13de67071 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -629,7 +629,8 @@ When nil, simply write \"#ERROR\" in corrupted fields.") (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|")) (hfmt1 (concat (make-string sp2 ?-) "%s" (make-string sp1 ?-) "+")) - emptystrings links dates emph narrow falign falign1 fmax f1 len c e) + emptystrings links dates emph narrow + falign falign1 fmax f1 len c e space) (untabify beg end) (remove-text-properties beg end '(org-cwidth t org-dwidth t display t)) ;; Check if we have links or dates @@ -745,7 +746,11 @@ When nil, simply write \"#ERROR\" in corrupted fields.") (text-property-any 0 (length (car c)) 'invisible 'org-link (car c)) ; (string-match org-bracket-link-regexp (car c)) (< (org-string-width (car c)) len)) - (setcar c (concat (car c) (make-string (- len (org-string-width (car c))) ?\ ))))))) + (progn + (setq space (make-string (- len (org-string-width (car c))) ?\ )) + (setcar c (if (nth i typenums) + (concat space (car c)) + (concat (car c) space)))))))) ;; Compute the formats needed for output of the table (setq rfmt (concat indent "|") hfmt (concat indent "|")) -- 2.11.4.GIT