From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#44068: 28.0.50; Faulty uses of tabulated-list-format Date: Sun, 18 Oct 2020 22:00:13 +0200 Message-ID: <87imb7e242.fsf@gmx.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33694"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: 44068@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 18 22:01:12 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 1kUErf-0008fF-Dh for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Oct 2020 22:01:11 +0200 Original-Received: from localhost ([::1]:46842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kUEre-0007rI-FP for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Oct 2020 16:01:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUErW-0007qn-CR for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 16:01:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55825) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kUErW-0005qq-2d for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 16:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kUErW-00017s-0g for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 16:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Oct 2020 20:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 44068 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16030512284272 (code B ref -1); Sun, 18 Oct 2020 20:01:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Oct 2020 20:00:28 +0000 Original-Received: from localhost ([127.0.0.1]:39138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUEqx-00016q-Ox for submit@debbugs.gnu.org; Sun, 18 Oct 2020 16:00:28 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:35516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUEqv-00016h-Ok for submit@debbugs.gnu.org; Sun, 18 Oct 2020 16:00:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUEqv-0007d4-El for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 16:00:25 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:42019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUEqs-0005hu-7V for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 16:00:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1603051219; bh=P7+sK1ABvr0XbmmqZe8LIWRzoEAyUMarXnNJ1p0yAmE=; h=X-UI-Sender-Class:From:To:Subject:Date; b=elnvVYj65PQmJR5HRGFBxTR16XfZ08RoEEDBUK50UQe19v/0th4ewnwFgRr3UWnzu OjzE9NHDQrTIUOpWWz2SGKMExDnjEfQDNv5hDt1mM35TiCHBVP26X1lGsFgJdeovTz rzr//2CboH/JNoZdLmw8h0jdJH2fe2RTfnC4Rjuk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from strobe-jhalfs ([178.6.223.210]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M1Hdq-1kSZtQ3Z2Q-002rT7 for ; Sun, 18 Oct 2020 22:00:19 +0200 X-Provags-ID: V03:K1:fmosVtfG6cYM6RfldVmzujsKXwViyHKOOxcvrEvhsrPqKsd/S9M 8OWR6cEqrE0s/Zjs2GNb4HKQ9YsJTvVMeFVn55uQZzDRSrF4A57dRFM0wWiN8pGziqzZ+GW ZHYVDsnhONNhy+ylxQsE4iJ6GWFTt2bWuAazMS13JTYhOeIni0G5Mu6i0aExYd7D7FyiPMM /qRFcSAxX0lJZAOE1drzA== X-UI-Out-Filterresults: notjunk:1;V03:K0:HE20P2jdNE4=:OehJDVnVI/t0T7jge5s4AF k75ZznKnKROIFow0V9LdoqWhaVPejTDxkJVS1ygynC+RRrN5N0I6DN1pb07S54I5jqmLdIVGW YjDl13kynUPyMUVPAs0XCVqHN/zZ0K8hBB/lPfdJDHt1a4nQJybWDPkTbD5NZoAr+9IdVh5nB fQGNCh3BqopCYZ0YQk5cNr0p5yV7J0jnaN+v3saIQh3KiKai7LYyaEK+fU7/RKTSgQIEPyGBD DYj3QZ9IphjaNZrGSYWpwbX7ZN2P/hDHIvIcXirsmcvosQW8BBAcxX2+H1UZ+WxpZZi+RCTlY u2gP0BKOPwQyr+18cWvI9wTzLONFIg3JGohjZrU1wA+Xedda9Oktj4AxXM4DqHe1Q4mHVabEF Gx6y1cB11MXy2TOOltB/x2YezV5E8Yh2MxQhO96bYoS8l3nInAorx4zkNgGh0SytJuKmHRMiH RqTd2rrftHCfpvOFKKJc9UrykdMDBUSBFFAmJRd0nU1cCCNuyITdSv1htS/WmLTPvV5sMJF47 xz1Pe0TEIHmAFYXhCqMtSPuWZrvurIrqmophPRwt0ryPKw8VLaRNUWq5TMa1/L3F6lU80Jl9o Wqld4ZzmMeDat41zZnIYqOFNmH/6/ADiIb5CVtLhtpxWlBW81lAY9eoAs0y+bkzGIAaBjNmFR OPsatOR4Gi35Wr1cntx1w6op4iZbIE0nMWBOkoyCv+9j+uM1bIN/LkfPyfg3jzHm6dGSB146q WTyDIWjwo7lfnhjVvPIuZhnviDKsGHzulBF6NewsOf+Pbu4DYhWaFw0SVh+0eV2OBObmflzk Received-SPF: pass client-ip=212.227.17.22; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/18 16:00:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:190914 Archived-At: --=-=-= Content-Type: text/plain On trying out the new tabulated-list implementation of the bookmarks list I noticed that, when clicking on the File header, the sort indicator is not displayed, unlike with the Bookmark header. Then I noticed that the same thing happens in the tabulated buffer list (C-x C-b). Then I grepped for all uses of tabulated-list-format in the Emacs sources and found the same problem in most of them. The reason is that in these modes the width of at least one of the columns is too narrow, so that tabulated-list-init-header omits the indicator. In most cases the problematic column is the final one, but in a couple of cases there are also non-final too narrow columns. And I think these bugs are due to a misleading description in tabulated-list-format's doc string. The attached patch corrects the doc string and the problematic uses of tabulated-list-format. The patch also fixes a typo and tries to improve column alignment in timer-list-mode: this is one of the few modes derived from tabulated-list-mode whose column widths didn't need to be corrected, but the alignment seemed suboptimal; however, when the header line uses a variable-pitch face, the alignment is still suboptimal even with the patch, and I don't know how to fix that. In GNU Emacs 28.0.50 (build 34, x86_64-pc-linux-gnu, GTK+ Version 3.24.17, cairo version 1.17.3) of 2020-10-18 built on strobe-jhalfs Repository revision: b7dfae3a8168977013e8de1df0916c51e76e7326 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12008000 System Description: Linux From Scratch SVN-20200401 2020-10-18 Stephen Berman Fix uses of tabulated-list-format * lisp/emacs-lisp/tabulated-list.el (tabulated-list-format): Correct the documentation of the WIDTH element. * lisp/bookmark.el (bookmark-bmenu-mode): * lisp/buff-menu.el (list-buffers--refresh): * lisp/emacs-lisp/package.el (package-menu-mode) (package-archive-column-width): * lisp/misc.el (list-dynamic-libraries--refresh): * lisp/org/org-lint.el (org-lint--report-mode): * lisp/progmodes/flymake.el (flymake-diagnostics-buffer-mode): * lisp/simple.el (process-menu-mode): Increase column width in order to display sort indicator. * lisp/emacs-lisp/timer-list.el (timer-list-mode): Improve column alignment. (timer-list--function-predicate): Correct typo in doc string. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Description: Fix uses of tabulated-list-format Content-Transfer-Encoding: quoted-printable diff --git a/lisp/bookmark.el b/lisp/bookmark.el index ab7b04ddfe..f37f0b0ce9 100644 =2D-- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -1783,7 +1783,7 @@ bookmark-bmenu-mode `[("" 1) ;; Space to add "*" for bookmark with annotation ("Bookmark" ,bookmark-bmenu-file-column bookmark-bmenu--name-pr= edicate) ,@(if bookmark-bmenu-toggle-filenames - '(("File" 0 bookmark-bmenu--file-predicate)))]) + '(("File" 6 bookmark-bmenu--file-predicate)))]) (setq tabulated-list-padding bookmark-bmenu-marks-width) (setq tabulated-list-sort-key '("Bookmark" . nil)) (add-hook 'tabulated-list-revert-hook #'bookmark-bmenu--revert nil t)' diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index d06ba28787..5cf13cb50f 100644 =2D-- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -706,7 +706,7 @@ list-buffers--refresh `("Size" ,size-width tabulated-list-entry-size-> :right-align t) `("Mode" ,Buffer-menu-mode-width t) - '("File" 1 t))) + '("File" 6 t))) (setq tabulated-list-use-header-line Buffer-menu-use-header-line) (setq tabulated-list-entries (nreverse entries))) (tabulated-list-init-header)) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 7b192d640b..32b99367c3 100644 =2D-- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -412,7 +412,7 @@ package-status-column-width :type 'number :version "28.1") -(defcustom package-archive-column-width 8 +(defcustom package-archive-column-width 9 "Column width for the Package status in the package menu." :type 'number :version "28.1") @@ -2770,7 +2770,7 @@ package-menu-mode ("Status" ,package-status-column-width package-menu--status-p= redicate) ,@(if (cdr package-archives) `(("Archive" ,package-archive-column-width package-menu--= archive-predicate))) - ("Description" 0 package-menu--description-predicate)]) + ("Description" 13 package-menu--description-predicate)]) (setq tabulated-list-padding 2) (setq tabulated-list-sort-key (cons "Status" nil)) (add-hook 'tabulated-list-revert-hook #'package-menu--refresh nil t) diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated= -list.el index b13f609f88..20e43d9c4a 100644 =2D-- a/lisp/emacs-lisp/tabulated-list.el +++ b/lisp/emacs-lisp/tabulated-list.el @@ -91,7 +91,9 @@ tabulated-list-format This is the label for the column in the header line. Different columns must have non-`equal' names. - WIDTH is the width to reserve for the column. - For the final element, its numerical value is ignored. + Its value must be at least 2 more than the length of NAME + in order to display the column's sort indicator. + Not used for computing the width of the final element. - SORT specifies how to sort entries by this column. If nil, this column cannot be used for sorting. If t, sort by comparing the string value printed in the column. diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el index 00d09696d2..afcd7d3354 100644 =2D-- a/lisp/emacs-lisp/timer-list.el +++ b/lisp/emacs-lisp/timer-list.el @@ -93,8 +93,8 @@ timer-list-mode (setq-local revert-buffer-function #'list-timers) (setq tabulated-list-format '[("Idle" 6 timer-list--idle-predicate) - (" Next" 12 timer-list--next-predicate) - (" Repeat" 11 timer-list--repeat-predicate) + ("Next" 12 timer-list--next-predicate :right-align t :pad-right= 1) + ("Repeat" 11 timer-list--repeat-predicate :right-align t :pad-r= ight 1) ("Function" 10 timer-list--function-predicate)])) (defun timer-list--idle-predicate (A B) @@ -119,7 +119,7 @@ timer-list--repeat-predicate (string< rA rB))) (defun timer-list--function-predicate (A B) - "Predicate to sort Timer-List by the Next column." + "Predicate to sort Timer-List by the Function column." (let ((fA (aref (cadr A) 3)) (fB (aref (cadr B) 3))) (string< fA fB))) diff --git a/lisp/misc.el b/lisp/misc.el index be191c50d2..b65f56efc3 100644 =2D-- a/lisp/misc.el +++ b/lisp/misc.el @@ -170,9 +170,9 @@ list-dynamic-libraries--refresh (name-len (apply 'max (mapcar 'length (cdr lib))))) (when (> id-len max-id-len) (setq max-id-len id-len)) (when (> name-len max-name-len) (setq max-name-len name-len= )))) - (vector (list "Library" (1+ max-id-len) t) - (list "Loaded from" (1+ max-name-len) t) - (list "Candidate names" 0 t)))) + (vector (list "Library" (+ max-id-len 2) t) + (list "Loaded from" (+ max-name-len 2) t) + (list "Candidate names" 17 t)))) (tabulated-list-init-header) (setq tabulated-list-entries nil) (dolist (lib dynamic-library-alist) diff --git a/lisp/org/org-lint.el b/lisp/org/org-lint.el index 5be1ec7286..0c3eca7998 100644 =2D-- a/lisp/org/org-lint.el +++ b/lisp/org/org-lint.el @@ -1089,8 +1089,8 @@ org-lint--report-mode (< (string-to-number (aref (cadr a) 0)) (string-to-number (aref (cadr b) 0)))) :right-align t) - ("Trust" 5 t) - ("Warning" 0 t)]) + ("Trust" 7 t) + ("Warning" 9 t)]) (tabulated-list-init-header)) (defun org-lint--generate-reports (buffer checkers) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index b286208fff..602e8f2609 100644 =2D-- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1376,7 +1376,7 @@ flymake-diagnostics-buffer-mode "Flymake diagnostics" "A mode for listing Flymake diagnostics." (setq tabulated-list-format - `[("Line" 5 ,(lambda (l1 l2) + `[("Line" 6 ,(lambda (l1 l2) (< (plist-get (car l1) :line) (plist-get (car l2) :line))) :right-align t) @@ -1384,7 +1384,7 @@ flymake-diagnostics-buffer-mode ("Type" 8 ,(lambda (l1 l2) (< (plist-get (car l1) :severity) (plist-get (car l2) :severity)))) - ("Message" 0 t)]) + ("Message" 9 t)]) (setq tabulated-list-entries 'flymake--diagnostics-buffer-entries) (tabulated-list-init-header)) diff --git a/lisp/simple.el b/lisp/simple.el index d6fce922c4..b34450aeb5 100644 =2D-- a/lisp/simple.el +++ b/lisp/simple.el @@ -4388,13 +4388,13 @@ process-menu-mode "Major mode for listing the processes called by Emacs." (setq tabulated-list-format [("Process" 15 t) ("PID" 7 t) - ("Status" 7 t) + ("Status" 8 t) ;; 25 is the length of the long standard b= uffer ;; name "*Async Shell Command*<10>" (bug#3= 0016) ("Buffer" 25 t) ("TTY" 12 t) ("Thread" 12 t) - ("Command" 0 t)]) + ("Command" 9 t)]) (make-local-variable 'process-menu-query-only) (setq tabulated-list-sort-key (cons "Process" nil)) (add-hook 'tabulated-list-revert-hook 'list-processes--refresh nil t)) --=-=-=--