GNU bug report logs - #37179
27.0.50; tabulated-list-mode creates obsolete empty line on the end

Previous Next

Package: emacs;

Reported by: Jean Louis <bugs <at> gnu.support>

Date: Sun, 25 Aug 2019 09:21:02 UTC

Severity: minor

Tags: notabug, wontfix

Found in version 27.0.50

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 37179 in the body.
You can then email your comments to 37179 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#37179; Package emacs. (Sun, 25 Aug 2019 09:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jean Louis <bugs <at> gnu.support>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 25 Aug 2019 09:21:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean Louis <bugs <at> gnu.support>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; tabulated-list-mode creates obsolete empty line on the end
Date: Sun, 25 Aug 2019 11:20:29 +0200

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



In GNU Emacs 27.0.50 (build 3, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2019-08-04 built on protected.rcdrun.com
Repository revision: 01661f33c11654d1fe5fe1013332db2500b7f449
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Hyperbola GNU/Linux-libre

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --prefix=/package/text/emacs-2019-08-04 --with-modules
 --without-gpm --with-x-toolkit=lucid'

Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM MODULES THREADS JSON PDUMPER
LCMS2 GMP

Important settings:
  value of $LC_ALL: de_DE.UTF-8
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort hashcash mail-extr emacsbug message rmc puny dired
dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache
epa derived epg epg-config gnus-util rmail rmail-loaddefs
text-property-search time-date subr-x seq byte-opt gv bytecomp
byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 45501 4860)
 (symbols 48 6060 1)
 (strings 32 16251 1822)
 (string-bytes 1 520282)
 (vectors 16 9853)
 (vector-slots 8 127249 7718)
 (floats 8 22 16)
 (intervals 56 242 0)
 (buffers 992 12))

-- 
Thanks,
Jean Louis




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37179; Package emacs. (Sun, 18 Oct 2020 23:57:02 GMT) Full text and rfc822 format available.

Message #8 received at 37179 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Jean Louis <bugs <at> gnu.support>
Cc: 37179 <at> debbugs.gnu.org
Subject: Re: 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 part 1 (text/plain, inline)]
Jean Louis <bugs <at> gnu.support> 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?
[37179.diff (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37179; Package emacs. (Mon, 19 Oct 2020 06:43:14 GMT) Full text and rfc822 format available.

Message #11 received at 37179 <at> debbugs.gnu.org (full text, mbox):

From: Jean Louis <bugs <at> gnu.support>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 37179 <at> debbugs.gnu.org
Subject: Re: bug#37179: 27.0.50; tabulated-list-mode creates obsolete empty
 line on the end
Date: Mon, 19 Oct 2020 09:41:00 +0300
I have tried that, and I like previous behavior so much more, as in
tabulated mode, the cursor then escapes on the end of line, which is
really not intended so.

In my opinion it is better to leave it as it is, and that I improve
my personal program that stops reacting on the end of line.

Jean

* Stefan Kangas <stefan <at> marxist.se> [2020-10-19 02:56]:
> Jean Louis <bugs <at> gnu.support> 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?

> diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
> index 2f7899ec51..7079eaad03 100644
> --- a/lisp/emacs-lisp/tabulated-list.el
> +++ b/lisp/emacs-lisp/tabulated-list.el
> @@ -480,6 +480,11 @@ tabulated-list-print
>                (forward-line 1)
>                (delete-region old (point))))))
>        (setq entries (cdr entries)))
> +    ;; Remove empty last line.
> +    (save-excursion
> +      (let ((inhibit-read-only t))
> +        (goto-char (point-max))
> +        (delete-char -1)))
>      (set-buffer-modified-p nil)
>      ;; If REMEMBER-POS was specified, move to the "old" location.
>      (if saved-pt





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37179; Package emacs. (Mon, 19 Oct 2020 08:55:02 GMT) Full text and rfc822 format available.

Message #14 received at 37179 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 37179 <at> debbugs.gnu.org, Jean Louis <bugs <at> gnu.support>
Subject: Re: bug#37179: 27.0.50; tabulated-list-mode creates obsolete empty
 line on the end
Date: Mon, 19 Oct 2020 10:54:26 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> I tend to agree; there doesn't seem to be any point to go to a line
> after the last entry.

As you point, in general we do allow going to the last line in most
special modes, even if most of the special commands make no sense the.
It's nice and unsurprising, and you can do things like `M-w' there.

So I don't think tabulated-list-mode should do anything special here,
because it'd be annoying.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37179; Package emacs. (Mon, 19 Oct 2020 08:58:01 GMT) Full text and rfc822 format available.

Message #17 received at 37179 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Jean Louis <bugs <at> gnu.support>
Cc: 37179 <at> debbugs.gnu.org
Subject: Re: bug#37179: 27.0.50; tabulated-list-mode creates obsolete empty
 line on the end
Date: Mon, 19 Oct 2020 08:57:38 +0000
tags 37179 + notabug wontfix
close 37179
thanks

Jean Louis <bugs <at> gnu.support> writes:

> I have tried that, and I like previous behavior so much more, as in
> tabulated mode, the cursor then escapes on the end of line, which is
> really not intended so.
>
> In my opinion it is better to leave it as it is, and that I improve
> my personal program that stops reacting on the end of line.

Jean told me in private that this should probably be closed, and I
concur, so I'm closing this bug report now.




Added tag(s) wontfix and notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 19 Oct 2020 08:58:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 37179 <at> debbugs.gnu.org and Jean Louis <bugs <at> gnu.support> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 19 Oct 2020 08:58:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37179; Package emacs. (Mon, 19 Oct 2020 16:06:01 GMT) Full text and rfc822 format available.

Message #24 received at 37179 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Jean Louis <bugs <at> gnu.support>, Stefan Kangas <stefan <at> marxist.se>
Cc: 37179 <at> debbugs.gnu.org
Subject: RE: bug#37179: 27.0.50; tabulated-list-mode creates obsolete empty
 line on the end
Date: Mon, 19 Oct 2020 09:05:46 -0700 (PDT)
> I have tried that, and I like previous behavior so much more, as in
> tabulated mode, the cursor then escapes on the end of line, which is
> really not intended so.

FWIW, I filed a related enhancement request, bug #44078.

`tabulated-list-mode' should not be dictating final
newline behavior, IMO.  It should be tamed to become
useful/usable in just part(s) of a buffer.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 17 Nov 2020 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 154 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.