From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: [RFC] Shrink columns dynamically Date: Mon, 10 Jul 2017 14:12:55 +0200 Message-ID: <87bmoswkvs.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUXZ5-0000jE-Ri for emacs-orgmode@gnu.org; Mon, 10 Jul 2017 08:13:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUXZ2-0001uK-N5 for emacs-orgmode@gnu.org; Mon, 10 Jul 2017 08:13:23 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:55899) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dUXZ2-0001gd-G0 for emacs-orgmode@gnu.org; Mon, 10 Jul 2017 08:13:20 -0400 Received: from saiph.selenimh (000043010000000000000469.ipv6.commingeshautdebit.fr [IPv6:2a03:a0a0:0:4301::469]) (Authenticated sender: mail@nicolasgoaziou.fr) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 66579C5A75 for ; Mon, 10 Jul 2017 14:12:55 +0200 (CEST) Received: from ngz by saiph.selenimh with local (Exim 4.89) (envelope-from ) id 1dUXYd-0003ec-94 for emacs-orgmode@gnu.org; Mon, 10 Jul 2017 14:12:55 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" 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., "" 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 "=3D>" 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.=20 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 | =3D> |=E2=80=A6| The character used for display (here "=E2=80=A6"), 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, --=20 Nicolas Goaziou 0x80A93738