From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#37179: 27.0.50; tabulated-list-mode creates obsolete empty line on the end Date: Sun, 18 Oct 2020 16:56:13 -0700 Message-ID: References: <86a7bxy52a.fsf@protected.rcdrun.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0000000000003beb8305b1fabe46" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38156"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 37179@debbugs.gnu.org To: Jean Louis Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 19 01:57:10 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 1kUIY1-0009ou-R8 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Oct 2020 01:57:09 +0200 Original-Received: from localhost ([::1]:44620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kUIY0-0003IX-T1 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Oct 2020 19:57:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUIXu-0003IQ-OQ for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 19:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56069) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kUIXu-0006iD-Dz for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 19:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kUIXu-0004yY-Da for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 19:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Oct 2020 23:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37179 X-GNU-PR-Package: emacs Original-Received: via spool by 37179-submit@debbugs.gnu.org id=B37179.160306538219075 (code B ref 37179); Sun, 18 Oct 2020 23:57:02 +0000 Original-Received: (at 37179) by debbugs.gnu.org; 18 Oct 2020 23:56:22 +0000 Original-Received: from localhost ([127.0.0.1]:39382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUIXG-0004xa-AI for submit@debbugs.gnu.org; Sun, 18 Oct 2020 19:56:22 -0400 Original-Received: from mail-ej1-f52.google.com ([209.85.218.52]:46735) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUIXF-0004xN-0Q for 37179@debbugs.gnu.org; Sun, 18 Oct 2020 19:56:21 -0400 Original-Received: by mail-ej1-f52.google.com with SMTP id t25so11358392ejd.13 for <37179@debbugs.gnu.org>; Sun, 18 Oct 2020 16:56:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:user-agent :mime-version:date:message-id:subject:to:cc; bh=JUoMor5c7NHcnMs7nrpZvRO8qoa7/4h2F/PrvWKpWig=; b=qf5qrwMOqbv7SFt3PDvcgOTRaiCFU3Zq/6clxI3G9vn2TGQobPVemsB6FnjPBzaNcz RkC6Vx7IUGutHa6bctBqQwrZ+Ndgsve9qKNfIYO8IsTFM5n+EqlMOcrfJjzcbU7SROip fTN2udUIe3SyPcl6dRGaaehOgoemmLVbe9cbtuiw8uCBjLUb4aO0yUxWFpmYledc5e6J BRlLhavW2/IASeKK3I4ELcefJe4MIcyMep3rB4C2Vxa3ur2pObqGKqrv2FELBe+81vNy 3cdsoZ/a0FWHzfJT6zWQvaewCKUFb1FF33AxpCSGrJZtny3w5eUSPbKzxuOWcy5WbfnQ z6wQ== X-Gm-Message-State: AOAM533ZM8uzTF35JWEexNnvzrNGTeHi9vOqhuYXY8shMo2BaRQXk7BB LiXfpjiCRMaPYmlp61qEEDq67H8Yq997GkWNtNw= X-Google-Smtp-Source: ABdhPJy97K8eB9HyE5t6NmEzHjs4nLDXJQfuEfqqiTAPQRlRBAvMjcyLupigzmZOc3MRcn/6aUCs1GWT43Ec92vcg8E= X-Received: by 2002:a17:906:3cd:: with SMTP id c13mr14480310eja.25.1603065375082; Sun, 18 Oct 2020 16:56:15 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 18 Oct 2020 16:56:14 -0700 In-Reply-To: <86a7bxy52a.fsf@protected.rcdrun.com> (Jean Louis's message of "Sun, 25 Aug 2019 11:20:29 +0200") 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:190934 Archived-At: --0000000000003beb8305b1fabe46 Content-Type: text/plain; charset="UTF-8" Jean Louis writes: > Here is sample demonstration: > > (define-derived-mode my-mode tabulated-list-mode "My Mode" "My mode" > (setq tabulated-list-format [("ID" 5 t . (:right-align t)) > ("Hyperlink" 30 t) > ("Type" 10 t)]) > (setq tabulated-list-padding 1) > (setq tabulated-list-sort-key (cons "ID" nil)) > (tabulated-list-init-header)) > > (defun my-set-list (&optional parent) > (interactive) > (let ((buffer "*Hyperspace*")) > (pop-to-buffer buffer nil) > (read-only-mode 0) > (erase-buffer) > (read-only-mode 1) > (my-mode) > (hl-line-mode) > (setq tabulated-list-entries (list > (list "1" ["1" "Link 1" "Type"]) > (list "2" ["2" "Link 2" "Type"]))) > (tabulated-list-print t))) > > When it is defined the M-x my-set-list allows me to go after the last > line. Yet that is not logical, and empty line shall not be displayed, as > it does not exist in the tabulated-list-entries variable. > > Video demonstration 1MB: > https://gnu.support/images/2019/08/2019-08-25/2019-08-25-11:15:46.ogv I tend to agree; there doesn't seem to be any point to go to a line after the last entry. But this issue is not unique to tabulated-list-mode, and in fact crops up in all kinds of places in Emacs. IME, the usual solution is to just leave the final newline, and maybe there are good reasons for that. See Dired for example, or Gnus. As an experiment, I came up with the attached patch that removes the final newline in `tabulated-list-mode'. As expected, it is not without issues: `end-of-buffer' leaves point at the end of last line. If that line is very long, we can end up scrolled far to the right, which is rather unsettling. Another thing that may or may not be problematic (I didn't test it) is if we have commands that operate on regions of lines. So I'm not exactly sure what to do here. Perhaps we should just leave it alone... Or maybe there is some smart solution just waiting to be discovered. Does anyone else have any comments? --0000000000003beb8305b1fabe46 Content-Type: text/x-diff; charset="US-ASCII"; name="37179.diff" Content-Disposition: attachment; filename="37179.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: 7140486919a7744b_0.1 ZGlmZiAtLWdpdCBhL2xpc3AvZW1hY3MtbGlzcC90YWJ1bGF0ZWQtbGlzdC5lbCBiL2xpc3AvZW1h Y3MtbGlzcC90YWJ1bGF0ZWQtbGlzdC5lbAppbmRleCAyZjc4OTllYzUxLi43MDc5ZWFhZDAzIDEw MDY0NAotLS0gYS9saXNwL2VtYWNzLWxpc3AvdGFidWxhdGVkLWxpc3QuZWwKKysrIGIvbGlzcC9l bWFjcy1saXNwL3RhYnVsYXRlZC1saXN0LmVsCkBAIC00ODAsNiArNDgwLDExIEBAIHRhYnVsYXRl ZC1saXN0LXByaW50CiAgICAgICAgICAgICAgIChmb3J3YXJkLWxpbmUgMSkKICAgICAgICAgICAg ICAgKGRlbGV0ZS1yZWdpb24gb2xkIChwb2ludCkpKSkpKQogICAgICAgKHNldHEgZW50cmllcyAo Y2RyIGVudHJpZXMpKSkKKyAgICA7OyBSZW1vdmUgZW1wdHkgbGFzdCBsaW5lLgorICAgIChzYXZl LWV4Y3Vyc2lvbgorICAgICAgKGxldCAoKGluaGliaXQtcmVhZC1vbmx5IHQpKQorICAgICAgICAo Z290by1jaGFyIChwb2ludC1tYXgpKQorICAgICAgICAoZGVsZXRlLWNoYXIgLTEpKSkKICAgICAo c2V0LWJ1ZmZlci1tb2RpZmllZC1wIG5pbCkKICAgICA7OyBJZiBSRU1FTUJFUi1QT1Mgd2FzIHNw ZWNpZmllZCwgbW92ZSB0byB0aGUgIm9sZCIgbG9jYXRpb24uCiAgICAgKGlmIHNhdmVkLXB0Cg== --0000000000003beb8305b1fabe46--