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
Date: Mon, 11 Jun 2018 14:06:41 -0400 [thread overview]
Message-ID: <20180611180641.x6azaqvvtbah23n4@E15-2016.optimum.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 619 bytes --]
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-06-11 18:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20180611180641.x6azaqvvtbah23n4@E15-2016.optimum.net \
--to=boruch_baum@gmx.com \
--cc=cyd@stupidchicken.com \
--cc=emacs-devel@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.