From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#32106: 25.2: tabulated-list-resize-current-column [PATCH INCLUDED] Date: Sun, 23 Jun 2019 19:56:23 -0700 (PDT) Message-ID: <19b9c926-3ec6-4130-a7d8-86fb82ac7061@default> References: <20180709155611.qtqa2s24rzx5osye@E15-2016.optimum.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="126805"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 32106@debbugs.gnu.org To: Lars Ingebrigtsen , Boruch Baum Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 24 04:57:10 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hfFAL-000Wsr-WE for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Jun 2019 04:57:10 +0200 Original-Received: from localhost ([::1]:47716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfFAK-0004I9-BS for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Jun 2019 22:57:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32804) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfFAE-0004I2-Tm for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 22:57:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hfFAD-0002oF-SB for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 22:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41821) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hfFAD-0002mQ-NC for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 22:57:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hfFAD-000826-JY for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 22:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jun 2019 02:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32106 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 32106-submit@debbugs.gnu.org id=B32106.156134499830847 (code B ref 32106); Mon, 24 Jun 2019 02:57:01 +0000 Original-Received: (at 32106) by debbugs.gnu.org; 24 Jun 2019 02:56:38 +0000 Original-Received: from localhost ([127.0.0.1]:55365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfF9q-00081T-9m for submit@debbugs.gnu.org; Sun, 23 Jun 2019 22:56:38 -0400 Original-Received: from userp2130.oracle.com ([156.151.31.86]:41578) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfF9o-00081G-5i for 32106@debbugs.gnu.org; Sun, 23 Jun 2019 22:56:37 -0400 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5O2su8c068513; Mon, 24 Jun 2019 02:56:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=35d5RsKbdaXPxlIFihTCsqYwfB++qYOTUGKSLHf9DYE=; b=SK03HySdTqBAz3pr2Qy4n7k2Cc1qsBqZsdL0AdbKnJE40Rj5AwWN1CzXeOadgRiZxwKY sVCGLATDxGG+p+2/fz5hSoWoXMwveRvDS4Gwd14jc4/nWQCoV1HPwxPUnh5mwNBatSSP JD+FVTkvW+BoEEiRBTAE0ZwYwreD+TjfkNmZfpQyLRFFKx7MrTRVhLED/QCCXfl0UTGR znQlFuSQHNt/puHeuFXB5AxUwY+wJevaIET4t4hkxy2S6CIcbJkDbmX+QWPv9ppvfG0l ees5mzFGUgO/QyfX8QgbJNmUWLBHMGakCxuD8wZTTvsgyUIc/wXfFRmMo70CJ1ygqJ5l CA== Original-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2t9brsurr3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jun 2019 02:56:30 +0000 Original-Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5O2u66c027176; Mon, 24 Jun 2019 02:56:29 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2t99f31q46-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jun 2019 02:56:29 +0000 Original-Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5O2uOpo004332; Mon, 24 Jun 2019 02:56:26 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4861.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9297 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906240022 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9297 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906240023 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:161192 Archived-At: > The code looks good to me -- Eli points out that it would be great if > you could mode the column sized with a mouse, too, but I think that's > kinda an orthogonal issue. If somebody were to add a mouse-drag thing > for tabulated mode (and somebody should), then it looks like your > function would perhaps work well as the underlying function for that > command. >=20 > So unless anybody objects, I'd like to include this command in > tabulated-list.el (and add documentation, of course). Yes, this is welcome. There are a few (relatively minor) problems with it, which are easily corrected. The code below is a bit better, I think. . The doc string was wrong wrt `tabulated-list-format' being a "defcustom" (an option) - it's not. And that var is always buffer-local (as are most things about `tabulated-list-mode'). So there's no reason for this command's doc to say its change is buffer-local. . There's a mix of meanings of "column" in the code and comments, starting with the main doc-string line: "Change width of the current column by N columns." It's clearer to use "column" only for either an Emacs character/buffer column or a `tabulated-list-mode' table column. In the code below I chose the latter, never calling the former a "column". . It's handier for users for the numeric arg to always be provided by the numeric prefix arg (default: 1). No prompting, and the command can then be repeated by just holding down a key. . With that change, by default the command widens the current column width, and its name can reflect that. Increasing by a negative number decreases, as usual. A separate command to narrow the column (decrease its width) should also be provided, for easy key binding. A user can bind both widen and narrow commands to repeatable keys. . No need to remember the start column. REMEMBER-POS arg to `tabulated-list-print' takes care of that. (defun tabulated-list-widen-current-column (&optional n) "Widen the current tabulated-list column by prefix-arg chars." (interactive "p") (let ((start (current-column)) (nb-cols (length tabulated-list-format)) (col-nb 0) (total-width 0) (found nil) col-width) (while (and (not found) (< col-nb nb-cols)) (if (> start (setq total-width (+ total-width (setq col-width (cadr (aref tabulated-list-format col-nb)))))) (setq col-nb (1+ col-nb)) (setq found t) (setf (cadr (aref tabulated-list-format col-nb)) (max 1 (+ col-width n))) (tabulated-list-print t) (tabulated-list-init-header))))) (defun tabulated-list-narrow-current-column (&optional n) "Narrow the current tabulated list column by N chars. See `tabulated-list-increase-current-column'." (interactive "p") (tabulated-list-increase-current-column (- n)))