all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Boruch Baum <boruch_baum@gmx.com>
To: 32106@debbugs.gnu.org
Subject: bug#32106: 25.2: tabulated-list-resize-current-column [PATCH INCLUDED]
Date: Mon, 9 Jul 2018 11:56:11 -0400	[thread overview]
Message-ID: <20180709155611.qtqa2s24rzx5osye@E15-2016.optimum.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 928 bytes --]


----- Forwarded message from Boruch Baum <boruch_baum@gmx.com> -----

Date: Mon, 11 Jun 2018 14:06:41 -0400
From: Boruch Baum <boruch_baum@gmx.com>
To: Emacs-Devel List <emacs-devel@gnu.org>
Cc: Chong Yidong <cyd@stupidchicken.com>
Subject: tabulated-list-resize-current-column
User-Agent: NeoMutt/20180512

Attached is a proposed contribution for the package `tabulated-list.el'.

The idea is to offer to emacs users a feature long-common in GUI
tabulated list widgets - the ability to dynamically resize columns. I
only use emacs in nox, so in my selfishness (and in my ignorance of most
programming things GUI) that's all this function provides, but it's a
start for anyone wanting to extend to that environment.

An obvious follow-up idea is a companion function to change the
sequence of columns, also a long-common feature in GUI environments.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0

[-- Attachment #2: tabulated-list-resize-current-column.el --]
[-- Type: text/plain, Size: 890 bytes --]

(defun tabulated-list-resize-current-column (&optional num)
  "Change width of the current column by N columns.

This is a buffer-local change. To permanently change a column's
size, see defcustom `tabulated-list-format'."
  (interactive "N(In/De)crease size of current column by:")
  (let ((col (current-column))
        (total-column-count 0)
        (len (length tabulated-list-format))
	(idx 0) this-column-size found)
   (while (and (not found) (< idx len))
     (if (> col (setq total-column-count
                    (+ total-column-count
                       (setq this-column-size
                         (cadr (aref tabulated-list-format idx))))))
       (setq idx (1+ idx))
      (setf (cadr (aref tabulated-list-format idx)) (max 1 (+ this-column-size num)))
      (setq found t)
      (tabulated-list-init-header)
      (tabulated-list-print)
      (move-to-column col)))))

             reply	other threads:[~2018-07-09 15:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09 15:56 Boruch Baum [this message]
2018-07-09 17:22 ` bug#32106: 25.2: tabulated-list-resize-current-column [PATCH INCLUDED] Eli Zaretskii
2018-07-09 18:42   ` Boruch Baum
2019-06-23 23:06 ` Lars Ingebrigtsen
2019-06-24  2:56   ` Drew Adams
2019-06-24  5:29     ` Boruch Baum
2019-06-24 13:56       ` Drew Adams
2019-06-24 14:37     ` Lars Ingebrigtsen
2019-06-24 15:07       ` Boruch Baum
2019-06-24 16:03         ` Lars Ingebrigtsen
2019-06-25 19:35           ` Juri Linkov
2019-06-25 20:32             ` Lars Ingebrigtsen
2019-06-24 15:51       ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180709155611.qtqa2s24rzx5osye@E15-2016.optimum.net \
    --to=boruch_baum@gmx.com \
    --cc=32106@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.