emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [RFC] Shrink columns dynamically


From: Nicolas Goaziou
Subject: Re: [O] [RFC] Shrink columns dynamically
Date: Thu, 27 Jul 2017 12:11:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hello,

Eric S Fraga <address@hidden> writes:

> I have two use cases which currently are managed with the width cookies
> and I can see that they probably should be managed differently.  The
> cases are:
>
> 1. a table with wide columns that is used to collect information
>    (publications with authors, title, journal, etc. is an example) and
>    which I use mostly by looking at it.  That is, I open the document
>    and scan down the table or page down or whatever.  I want this table
>    displayed initially with columns (e.g. title) narrowed to a specified
>    width.
>
> 2. a table with many columns, too many of the screen width even if each
>    column may only be a few characters wide, but one which I intend to
>    be manipulating extensively.  In this case, I may want to
>    shrink/narrow/hide columns to make it easier to edit and do
>    calculations.
>
> At present, I use width cookies for both.  They work well for use case
> 1; much less well for use case 2.  For me, these use cases are
> orthogonal.  I would be happy with two different approaches or the same
> approach so long as the latter would retain the ability to save the view
> (for use case 1).

I pushed another take on the problem in "hide-table-column" branch.
Rebasing is required.

There, two commands are defined

  - `org-table-toggle-column-width'

     Shrink or expand column at point. More specifically, if the column
     contains a width cookie, the column is shrunk according to it.
     Otherwise, it is shrunk to 1 character. Here is its docstring:

        Shrink or expand current column in an Org table.

        If a width cookie specifies a width W for the column, the first
        W visible characters are displayed.  Otherwise, the column is
        shrunk to a single character.

        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 `C-u]' prefix, ask for the range specification.

        When called with `C-u C-u' prefix, expand all columns.

  - `org-table-shrink'

     Shrink all columns with a width cookie. Other columns are expanded.
     This is morally equivalent to the current behaviour, although it is
     now decoupled from aligning.

Moreover, I added two new STARTUP keywords: "shrink" and "noshrink",
which allow to apply aforementioned `org-table-shrink' command on all
tables upon opening a document. Not that "align" no longer toggle column
width.

Feedback welcome.

Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]