From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Boruch Baum Newsgroups: gmane.emacs.devel Subject: tabulated-list-resize-current-column Date: Mon, 11 Jun 2018 14:06:41 -0400 Message-ID: <20180611180641.x6azaqvvtbah23n4@E15-2016.optimum.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="zyn2d43puzamrtrb" X-Trace: blaine.gmane.org 1528740299 23807 195.159.176.226 (11 Jun 2018 18:04:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 11 Jun 2018 18:04:59 +0000 (UTC) User-Agent: NeoMutt/20180512 Cc: Chong Yidong To: Emacs-Devel List Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 11 20:04:55 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSRBW-000668-PX for ged-emacs-devel@m.gmane.org; Mon, 11 Jun 2018 20:04:54 +0200 Original-Received: from localhost ([::1]:50685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSRDd-0002u0-ND for ged-emacs-devel@m.gmane.org; Mon, 11 Jun 2018 14:07:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSRDU-0002sy-Fo for emacs-devel@gnu.org; Mon, 11 Jun 2018 14:06:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSRDR-00042M-54 for emacs-devel@gnu.org; Mon, 11 Jun 2018 14:06:56 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:49677) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSRDQ-000415-QI for emacs-devel@gnu.org; Mon, 11 Jun 2018 14:06:53 -0400 Original-Received: from E15-2016.optimum.net ([108.6.168.221]) by mail.gmx.com (mrgmx002 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LrvWY-1gO4jb1BFe-013hTT; Mon, 11 Jun 2018 20:06:45 +0200 Content-Disposition: inline X-Provags-ID: V03:K1:f9vPW0hoVVy/GWPqeFih8LAzXq2Pgqxr/MqxVpiDpdLadSUFYjE GPmAjIyCQ+6eRJ1fG4i0SuoP4jAVgdn/Rw39a9YNnOIg02sP4LauI0iz23Nef32LkKbsBq/ /W8Rc634dh6PaWXNDrEXteMPK4ECUSKZOYp1Nvz/E8Rwy2k50735oAM3Npin92uUhvegsMV n+i15VTQiU0nE5ArMkNVw== X-UI-Out-Filterresults: notjunk:1;V01:K0:iKyJVH4W6z0=:JNuBcJT/kMzq9OFwF36BEN KQJf2Hsyy/utCyVK1olKg4U1buT6geP+WU8Zy0q5oOGC2nwYs/a9JiCiXOFSQ8TThKyfppTFq qFNtybPk9Zwau3xkkc8OnTL61Cgmj3LiSr5cNUWYV/BlQw1j40/OfNUPPsFctP7poKHvIGN4L oMMUkQJlFAiSMp7GUzUqj5lTF9BYmziMeVTrZE7vyGLLZwl3OyDXxFchAkkA66DODGWDXqQDx yk9399lXc5LYzqdw4nlY3+eJWPdGi/zVO/bu8CqrrnAXysxDz+iMsc7ImwVyKxwXfGsroNKI7 HOhGgSWbgC/M94DyLzHjqkTOiOQ7f7en06Z6yWas6sxTEFZDNyhzMxqHLr42MFMYcgdKZNPTu euJS8nasuNWqOSdKsHWRhMEJtUHAGmlMfr2/zN/a/i58v87MucWwFPIzX3GZHgfk6/LGF7AdK OCnrI2Ra80Zhmaiy6KBGYL5vUtCpww99GAuiu0HuRk5Ehk5zRMq+4SZ+5SxhahMKf8SZjQAyu Pm0ymbHWV8JzK/WQyjHgCgdzFm8bArz+HSY5Ax6TGKtaPvU9UlEfuUHkCaNwtfivu8rFLanRz xde9w8rjw8iHoqD9RFoxSkyETZHVlIVMHQ/BXiudTgwXnJuj61BQ8Rp3kXLMUQ6rVXdli8UYQ m0jhbYnqLfJY2AnLNkPcJllTc/BTIygwm6hesKuQXVUUUYip2pVMkzihuScLXx/pQxbyAighf B0HMFc+yFgznXz6R8+Xm2rxT9Urx027e2SuwGaoKMaKykuWSeGVOhTbNG30= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.15.18 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226233 Archived-At: --zyn2d43puzamrtrb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --zyn2d43puzamrtrb Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="tabulated-list-resize-current-column.el" (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))))) --zyn2d43puzamrtrb--