all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#32106: 25.2: tabulated-list-resize-current-column [PATCH INCLUDED]
@ 2018-07-09 15:56 Boruch Baum
  2018-07-09 17:22 ` Eli Zaretskii
  2019-06-23 23:06 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 13+ messages in thread
From: Boruch Baum @ 2018-07-09 15:56 UTC (permalink / raw)
  To: 32106

[-- 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)))))

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

end of thread, other threads:[~2019-06-25 20:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-09 15:56 bug#32106: 25.2: tabulated-list-resize-current-column [PATCH INCLUDED] Boruch Baum
2018-07-09 17:22 ` 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

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.