summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-12-23 23:37:45 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-12-23 23:37:45 +0100
commitf4ae1941c90e578e914268891bceff5751fbfd70 (patch)
tree9d302daeff0d21f896243d3da38bf9ba8b971e15
parentd9125e435f09128bf9593fa598c3fc8a9c48c8d0 (diff)
downloadorg-mode-f4ae1941c90e578e914268891bceff5751fbfd70.tar.gz
org-table: Improve bidirectional reordering in tablesrelease_9.1.5
* lisp/org-table.el (org-table-separator-space): New variable. (org-table-align): Use new variable.
-rw-r--r--lisp/org-table.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 6ebd6da..6bcb9e1 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -496,6 +496,12 @@ variable is initialized with `org-table-analyze'.")
(concat "\\(" "@[-0-9I$]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\)")
"Match a reference that needs translation, for reference display.")
+(defconst org-table-separator-space
+ (propertize " " 'display '(space :width 1))
+ "Space used around fields when aligning the table.
+This space serves as a segment separator for the purposes of the
+bidirectional reordering.")
+
(defmacro org-table-save-field (&rest body)
"Save current field; execute BODY; restore field.
Field is restored even in case of abnormal exit."
@@ -882,7 +888,10 @@ edit. Full value is:\n"
;; Compute the formats needed for output of the table.
(let ((hfmt (concat indent "|"))
(rfmt (concat indent "|"))
- (rfmt1 " %%%s%ds |")
+ (rfmt1 (concat org-table-separator-space
+ "%%%s%ds"
+ org-table-separator-space
+ "|"))
(hfmt1 "-%s-+"))
(dolist (l lengths (setq hfmt (concat (substring hfmt 0 -1) "|")))
(let ((ty (if (pop typenums) "" "-"))) ; Flush numbers right.