From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column' Date: Tue, 17 Nov 2020 18:35:52 +0000 Message-ID: <873617al13.fsf@tcd.ie> References: <87wnyj6fc8.fsf@nexoid.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3792"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 44711@debbugs.gnu.org To: "Peter Feigl" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 17 19:37:09 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kf5qn-0000t7-Dd for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Nov 2020 19:37:09 +0100 Original-Received: from localhost ([::1]:36066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kf5qm-0002JA-FM for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Nov 2020 13:37:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kf5qg-0002J3-MS for bug-gnu-emacs@gnu.org; Tue, 17 Nov 2020 13:37:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49604) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kf5qg-0003Gj-CZ for bug-gnu-emacs@gnu.org; Tue, 17 Nov 2020 13:37:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kf5qg-0002eo-Al for bug-gnu-emacs@gnu.org; Tue, 17 Nov 2020 13:37:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Nov 2020 18:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44711 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 44711-submit@debbugs.gnu.org id=B44711.160563816410127 (code B ref 44711); Tue, 17 Nov 2020 18:37:02 +0000 Original-Received: (at 44711) by debbugs.gnu.org; 17 Nov 2020 18:36:04 +0000 Original-Received: from localhost ([127.0.0.1]:32913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kf5pk-0002dG-8D for submit@debbugs.gnu.org; Tue, 17 Nov 2020 13:36:04 -0500 Original-Received: from mail-wr1-f47.google.com ([209.85.221.47]:40608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kf5pg-0002ce-8r for 44711@debbugs.gnu.org; Tue, 17 Nov 2020 13:36:03 -0500 Original-Received: by mail-wr1-f47.google.com with SMTP id m6so7013523wrg.7 for <44711@debbugs.gnu.org>; Tue, 17 Nov 2020 10:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=SP+Fxt9QMyirLtD1pV4x4KTc3LR+Z76WTXmvPTGYSpM=; b=znqDJlWrh2E0qgntGGGSkzZFQfCkvWT5t6+4L8ZcMRL77/cL/3AaD+ae5rU+3rroT6 dw9t2m1A8ilhOJbzNpQL/385Aoc1dlPWe/AsbOcdEBSoDYJCJ2jUXJ7osH2lT+9nAnuU GWtZVXMxe0l9Sow0pqNgGVIlGBo+hKShEquKPalGxaV7fmX0Wp2NBYqtNI/M663DOi8L KWq/zJvRLcXuinStJNRZ7clAbST783va3LfVWF209ARtqHvRag0vuH9zYaEWBYuvyDne 5WN7ODmPffC38qmz63dZ0XYrmgt6MjdpTjlIIhjMoaD0VWdFZaXEwFr7Ac+h3G9yt7uZ TmXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=SP+Fxt9QMyirLtD1pV4x4KTc3LR+Z76WTXmvPTGYSpM=; b=ooZGL9Bu0Ee8NJc+TVt/B1QvVRL8fsIWkvczvqMGBmZeXKBRVztjm0qO6oCUqVdpjN DdteoKpvt1Mv1Y4/Q2qsvh6yIwRYLp9v3WULBHDXOau6PtcWc5N6sTWpLDk3NX4o1a9N XxG1e/vbz80jkJ5mZYpmyYcgERqrMyQl2U3oDfk+l6RXbrYPhMUBtOhwc55Itf0K0VQI U5vObJj2II07Jm3usyfG41FlsEwFSEYEC+M5CEIjSKjFmnnzJyZz9SSOagnfzvriSPpT 9d1Ob81FB+h0k6VGneizkbhrDL8nrQjtF+/DlLsCTXK3mMxhduVCgiMf5+UWWm01M0DG gntg== X-Gm-Message-State: AOAM533HqJMkRugUN/0KpdJW7JApaZJdpzUXrDmpMQYsAkx0tZ9nR6Qa 8aSgCfStq76SJdIwanCCKRvWNg== X-Google-Smtp-Source: ABdhPJzhhGBzCQEAsP+ge1VE55xEIYltITjxoKIYYqpNuQz7aCsG0m/InTqTx550xmx+tRz05D0Q1g== X-Received: by 2002:a5d:51c2:: with SMTP id n2mr947492wrv.326.1605638154341; Tue, 17 Nov 2020 10:35:54 -0800 (PST) Original-Received: from localhost ([2a02:8084:20e2:c380:92bd:1bfd:38fc:fae2]) by smtp.gmail.com with ESMTPSA id u16sm28528366wrn.55.2020.11.17.10.35.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 10:35:53 -0800 (PST) In-Reply-To: <87wnyj6fc8.fsf@nexoid.at> (Peter Feigl's message of "Tue, 17 Nov 2020 18:52:23 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:193566 Archived-At: "Peter Feigl" writes: > The attached patch adds two movement commands, Thanks, just some minor comments from me. > +(defun tabulated-list-next-column (&optional arg) > + "Go to the start of the next column after point on the current line. > +If ARG is provided, move that many columns." > + (interactive "p") > + (dotimes (c (or arg 1)) ^ The names of unused lexical variables should start with (or consist only of) an underscore, e.g. '_' or '_c'. (The byte-compiler should otherwise complain.) > + (let ((next (or (next-single-property-change (point) 'tabulated-list-column-name) (point-max)))) This line is a bit long; suggest breaking the function call across two lines. More importantly, why scan all the way to the end of the buffer if we're only interested in the current line? > + (unless (>= next (line-end-position)) > + (goto-char next))))) Given my suggestion to limit the search to the current line, this could be modified along the following lines: (dotimes (_ (or arg 1)) (let* ((eol (line-end-position)) (next (next-single-property-change (point) 'tabulated-list-column-name nil (1+ eol)))) (when (< next eol) (goto-char next)))) But there's a subtle issue here: some tabulated lists (e.g. list-buffers) can have an empty final column (e.g. with non-file-visiting buffers such as *scratch*), but the (< next eol) guard will not allow point to reach this final empty column, because that position is at the end of the line. So I suggest either augmenting the guard to check whether the current (last) column is empty, or unconditionally allowing point to reach the end of the line, even if point was already originally in the final column. > +(defun tabulated-list-previous-column (&optional arg) Ditto. -- Basil