diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-03-27 16:13:45 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-03-27 16:13:45 +0100 |
commit | b34982368728d791c80e21f07f5046a050292f2d (patch) | |
tree | 455c2669451f0d9fb91603231b9f74a064242286 | |
parent | 3cc99bdc1f6c409e094f27ba92cab78c8fd4962f (diff) | |
download | org-mode-b34982368728d791c80e21f07f5046a050292f2d.tar.gz |
Tables: Interpret <N> as fixed width, not maximum width
Requested by Michael Brand
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/org.texi | 14 | ||||
-rwxr-xr-x | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/org-table.el | 4 |
4 files changed, 20 insertions, 8 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index c03b493..7f9a514 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2010-03-27 Carsten Dominik <carsten.dominik@gmail.com> + + * org.texi (Column width and alignment): Document that <N> now + means a fixed width, not a maximum width. + 2010-03-26 Carsten Dominik <carsten.dominik@gmail.com> * org.texi (Publishing options): Document the :email option. diff --git a/doc/org.texi b/doc/org.texi index 309f9a8..671df0c 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -1825,13 +1825,13 @@ The width of columns is automatically determined by the table editor. And also the alignment of a column is determined automatically from the fraction of number-like versus non-number fields in the column. -Sometimes a single field or a few fields need to carry more text, -leading to inconveniently wide columns. To limit@footnote{This feature -does not work on XEmacs.} the width of a column, one field anywhere in -the column may contain just the string @samp{<N>} where @samp{N} is an -integer specifying the width of the column in characters. The next -re-align will then set the width of this column to no more than this -value. +Sometimes a single field or a few fields need to carry more text, leading to +inconveniently wide columns. Or maybe you want to make a table with several +columns having a fixed width, regardless of content. To set@footnote{This +feature does not work on XEmacs.} the width of a column, one field anywhere +in the column may contain just the string @samp{<N>} where @samp{N} is an +integer specifying the width of the column in characters. The next re-align +will then set the width of this column to this value. @example @group diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2d18280..848c42c 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-03-27 Carsten Dominik <carsten.dominik@gmail.com> + + * org-table.el (org-table-align): Interpret <N> at fixed width, + not as maximum width. + 2010-03-26 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-author-info, org-export-email-info): Fix diff --git a/lisp/org-table.el b/lisp/org-table.el index 9614608..f26ad2e 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -662,6 +662,7 @@ When nil, simply write \"#ERROR\" in corrupted fields.") (while (< (setq i (1+ i)) maxfields) ;; Loop over all columns (setq column (mapcar (lambda (x) (or (nth i x) "")) fields)) ;; Check if there is an explicit width specified + (setq fmax nil) (when (or narrow falign) (setq c column fmax nil falign1 nil) (while c @@ -687,7 +688,8 @@ When nil, simply write \"#ERROR\" in corrupted fields.") (list 'display org-narrow-column-arrow) xx))))) ;; Get the maximum width for each column - (push (apply 'max 1 (mapcar 'org-string-width column)) lengths) + (push (apply 'max (or fmax 1) 1 (mapcar 'org-string-width column)) + lengths) ;; Get the fraction of numbers, to decide about alignment of the column (if falign1 (push (equal (downcase falign1) "r") typenums) |