emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [RFC] Shrink columns dynamically
@ 2017-07-10 12:12 Nicolas Goaziou
  2017-07-10 14:36 ` Uwe Brauer
  0 siblings, 1 reply; 38+ messages in thread
From: Nicolas Goaziou @ 2017-07-10 12:12 UTC (permalink / raw)
  To: Org Mode List

Hello,

Currently, the only way to shrink an Org table column is to use
a so-called width cookie (e.g., "<c10>" or "<10>") so that aligning
table forces the column to fit within the specified number of
characters. When the width is less than the number of characters in the
field, contents is hidden with "=>" string.

Besides, width cookies are interpreted by some export back-ends.

I think this situation is not good for two major reasons:
  - width cookies have two orthogonal uses,
  - hiding a column implies modifying the table.

I'd like to replace the visual effect of width cookies (not
interpretation by export back-ends) with a more dynamic one. To that
effect, I pushed a "hide-table-column" branch in the repository. 

There, the single user-facing function is
`org-table-toggle-column-visibility'. Its docstring is

      Shrink or expand current column in an Org table.

    When optional argument ARG is a string, use it as white space
    separated list of column ranges.  A column range can be one of
    the following patterns:

      N    column N only
      N-M  every column between N and M (both inclusive)
      N-   every column between N (inclusive) and the last column
      -M   every column between the first one and M (inclusive)
      -    every column

    When called with `\\[universal-argument]' prefix, ask for the \
    range specification.

    When called with `\\[universal-argument] \\[universal-argument]' \
    prefix, expand all columns.

It allows to quickly shrink or expand one of more columns in a table,
e.g., "1 3-4 6-". A shrunk column is only 1 character wide, not counting
vertical bars:

  | 123 |    =>   |…|

The character used for display (here "…"), is customizable with
`org-table-shrunk-column-display' variable.

A shrunk column expands whenever an interactive change happens in some
of its fields. Thus, re-calculating a table does not count.

Unlike to width cookies, no column is shrunk upon opening the buffer.
Due to its dynamic state, shrunk columns are not restored across
sessions either. I thought about "fixing" the first point with a new
STARTUP value that would shrink any column with a width cookie, but that
conflicts with the first motivation given earlier.

Feedback welcome. In particular, please test it and report if this is
a viable replacement for width cookies. Also, the
`org-table-toggle-column-visibility' function current misses a binding.
Suggestions welcome.

Regards,

-- 
Nicolas Goaziou                                                0x80A93738

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2017-09-06 13:30 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-10 12:12 [RFC] Shrink columns dynamically Nicolas Goaziou
2017-07-10 14:36 ` Uwe Brauer
2017-07-10 14:43   ` Nicolas Goaziou
2017-07-10 19:47     ` Uwe Brauer
2017-07-10 20:14       ` Nick Dokos
2017-07-10 20:59       ` Nicolas Goaziou
2017-07-11  6:27         ` Uwe Brauer
2017-07-11  7:54           ` Nicolas Goaziou
2017-07-11  8:35             ` Uwe Brauer
2017-07-11 11:41               ` Nicolas Goaziou
2017-07-11 12:03                 ` Uwe Brauer
2017-07-11 12:24                   ` Nicolas Goaziou
2017-07-11 17:56                     ` Kaushal Modi
2017-07-11 19:09                       ` Nicolas Goaziou
2017-07-11 19:23                         ` Kaushal Modi
2017-07-12  7:22                           ` Colin Baxter
2017-07-12 10:17                             ` Nicolas Goaziou
2017-07-12 16:06                               ` Colin Baxter
2017-07-12 19:14                               ` Rick Frankel
2017-07-27 11:47                                 ` Nicolas Goaziou
     [not found]                             ` <158a779e34564ef98104c442384dadd3@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-07-12 16:10                               ` Eric S Fraga
2017-07-16 10:54                                 ` B.V. Raghav
2017-07-27 10:14                                   ` Nicolas Goaziou
2017-07-27 10:11                                 ` Nicolas Goaziou
2017-07-31 22:29                                   ` Adam Porter
2017-08-05 22:56                                     ` Nicolas Goaziou
     [not found]                                 ` <e59b6e794bff46c29380611204d00402@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-07-27 10:49                                   ` Eric S Fraga
2017-08-05 22:54                                     ` Nicolas Goaziou
2017-08-19 16:54                                       ` Nicolas Goaziou
2017-09-06 13:29                                         ` Nicolas Goaziou
2017-07-11 20:21                         ` Uwe Brauer
2017-07-11  9:32             ` Uwe Brauer
2017-07-10 22:11     ` Kaushal Modi
2017-07-11  6:16       ` Michael Brand
2017-07-11 11:18         ` Deleting org table columns during export (Was: [RFC] Shrink columns dynamically) Kaushal Modi
2017-07-11 16:43           ` Michael Brand
2017-07-11 11:47         ` [RFC] Shrink columns dynamically Nicolas Goaziou
2017-07-11 16:40           ` Michael Brand

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).