GNU bug report logs - #39293
[PATCH] Base bookmark-bmenu-mode on 'tabulated-list-mode'

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Stefan Kangas <stefan@HIDDEN>; Keywords: patch; dated Sun, 26 Jan 2020 16:15:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 39293 <at> debbugs.gnu.org:


Received: (at 39293) by debbugs.gnu.org; 26 Jan 2020 22:35:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 26 17:35:36 2020
Received: from localhost ([127.0.0.1]:57629 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ivqVE-0000Jo-ED
	for submit <at> debbugs.gnu.org; Sun, 26 Jan 2020 17:35:36 -0500
Received: from aserp2120.oracle.com ([141.146.126.78]:54638)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1ivqVC-0000JW-7w
 for 39293 <at> debbugs.gnu.org; Sun, 26 Jan 2020 17:35:35 -0500
Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1])
 by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00QMZSOr039669;
 Sun, 26 Jan 2020 22:35:28 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-2019-08-05;
 bh=yao9DfHX/KM9Ex3Azj9F/Kno0rhNbwDgioaCjD1GdhM=;
 b=amydPpN0DUmyCaD2atVsYlGGMWVZzKfV2QvCf9ROjJe947vxrIDyN+Woh/VNYloMhnvC
 NR93Qv/oehMrgpKQ3xizd8758aOEJVAXlKC62Ghmavefo7DJB3ALmH0FlJuwIS8Bz2eS
 p0k6w7bSGTjwVksKnGI/xFOmVwPvOkTxObT80qEtyIqgO5pzbf75P07gtRLkXx0bGOIo
 UET1ERUPUtdcxkBQpevUKBRcGMXydd/zFUuk3Ytb8/2+bmuUbXLX9zgQux3KEDKPiFIx
 S4g6wO/8LepAU2jwVODb1o4+bCu1BT28/SsGoj/qBbRLXO7D7v7zFfPnTDp8F0Nx+UeK fQ== 
Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80])
 by aserp2120.oracle.com with ESMTP id 2xrdmq4fvb-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Sun, 26 Jan 2020 22:35:28 +0000
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 00QMY5Dt074509;
 Sun, 26 Jan 2020 22:35:27 GMT
Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72])
 by userp3030.oracle.com with ESMTP id 2xry4t0yxu-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Sun, 26 Jan 2020 22:35:27 +0000
Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11])
 by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 00QMZO1K023915;
 Sun, 26 Jan 2020 22:35:26 GMT
MIME-Version: 1.0
Message-ID: <376f3945-8247-4be6-b519-6aefa1ddc819@default>
Date: Sun, 26 Jan 2020 14:35:23 -0800 (PST)
From: Drew Adams <drew.adams@HIDDEN>
To: Stefan Kangas <stefan@HIDDEN>
Subject: RE: bug#39293: [PATCH] Base bookmark-bmenu-mode on
 'tabulated-list-mode'
References: <87lfpu9ag8.fsf@HIDDEN>
 <047a219c-5378-4cb6-97bb-e57187324988@default> <87zhea6mih.fsf@HIDDEN>
In-Reply-To: <87zhea6mih.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4954.0 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9512
 signatures=668685
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=929
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1911140001 definitions=main-2001260196
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9512
 signatures=668685
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=988 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001
 definitions=main-2001260196
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39293
Cc: 39293 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

I think I've said what I have to say about this.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39293; Package emacs. Full text available.

Message received at 39293 <at> debbugs.gnu.org:


Received: (at 39293) by debbugs.gnu.org; 26 Jan 2020 19:33:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 26 14:33:37 2020
Received: from localhost ([127.0.0.1]:57518 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ivnf6-0004JC-RF
	for submit <at> debbugs.gnu.org; Sun, 26 Jan 2020 14:33:37 -0500
Received: from ted.gofardesign.uk ([67.225.143.91]:50976)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefan@HIDDEN>) id 1ivnf5-0004J0-B9
 for 39293 <at> debbugs.gnu.org; Sun, 26 Jan 2020 14:33:36 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; 
 s=default;
 h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ZFGrocU3NGwZgYLcF8f56QclAlimYDwPm4BcajJ/+UI=; b=FhPyegE0hZgAAVAJevH1R+9mtP
 HBfTTlNlUm7eM1fvs7E9ck54k5SYpcrxc9h66+xAe5ddP53f2nrHwmiGQmVrYgXiXRhnwlTCj9SPb
 i0QX5nxqoP3NcREEKHtwd/q1IHYfbcupWBJ5GOc3arrUpoJkB456ZnI4/4tXDiWzvh8E0g5AJ2aks
 aYFNjLdQoMN11VARvPRQ6OuWPlkPvKJcb7KajA/LFK3/l4yxabTqlzO6ZWMMxxhqbVg+1rZHlvCdn
 t+SavkIJB3ZoS2MlorVHEOt0Vkj44MOFt3kdxJ0bldKCYdzvI4qglgIEr85hTXDll5/bnKVx27BmW
 tOO87eiw==;
Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:49246
 helo=localhost)
 by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
 (Exim 4.92) (envelope-from <stefan@HIDDEN>)
 id 1ivney-000KYf-Qz; Sun, 26 Jan 2020 14:33:29 -0500
From: Stefan Kangas <stefan@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#39293: [PATCH] Base bookmark-bmenu-mode on
 'tabulated-list-mode'
In-Reply-To: <047a219c-5378-4cb6-97bb-e57187324988@default> (Drew Adams's
 message of "Sun, 26 Jan 2020 10:05:48 -0800 (PST)")
References: <87lfpu9ag8.fsf@HIDDEN>
 <047a219c-5378-4cb6-97bb-e57187324988@default>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
Date: Sun, 26 Jan 2020 20:33:26 +0100
Message-ID: <87zhea6mih.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - ted.gofardesign.uk
X-AntiAbuse: Original Domain - debbugs.gnu.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - marxist.se
X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id:
 stefan@HIDDEN
X-Authenticated-Sender: ted.gofardesign.uk: stefan@HIDDEN
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39293
Cc: 39293 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Drew Adams <drew.adams@HIDDEN> writes:

>> Any comments, objections or suggestions?  Thanks.
>
> I _strongly_ object to this.  And I would say the same
> thing if such a suggestion were made for Dired.

- This is not about Dired, so let's please leave that to one side.

- This is not just code cleanup.  I think 'tabulated-list-mode' gives
  clear benefits to users today.  Sorting is one example which will
  immediately improve.  Mouse support is another.

- I'm not convinced that it's necessary, but I don't see the problem
  with an interactive bookmark menu in bookmark+.el (or any
  third-party package really) that is not directly based on the code
  in Emacs.

> 2. Not appreciating the specificity of the features
>    offered by libraries such as Dired and bookmarking.
>
>    Not being well acquainted with such features, and
>    so supposing that they don't exist or they're no
>    big deal and not worth bothering about.

Which features are you talking about?

>   Sorting in Dired or the bookmark list (at least with
>   Bookmark+) is _much more_ useful and flexible than
>   just sorting columns.  Why?  Because the things
>   displayed are of different kinds across rows, not
>   just across columns.  The columns, for bookmark-list
>   display, are less interesting (this is less true of
>   Dired, but the same consideration holds).

I don't understand this argument.  It seems to be based on the
misunderstanding that 'tabulated-list-mode' somehow limits you to sort
by column.

> Yes, I use it (e.g. in my library `apu.el').  But it
> is very limited, and the limitations do not just stem
> from a lack of more generic features.  I use it only
> when it's appropriate.

To my mind, this is the most convincing argument you presented.  Yet
you have not shown any limitations in 'tabulated-list-mode' that makes
it unsuitable for 'bookmark-bmenu-mode'.  Could you please explain
which limitations you see, and how you concretely see them affecting
bookmark-bmenu-mode?

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39293; Package emacs. Full text available.

Message received at 39293 <at> debbugs.gnu.org:


Received: (at 39293) by debbugs.gnu.org; 26 Jan 2020 18:08:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 26 13:08:00 2020
Received: from localhost ([127.0.0.1]:57454 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ivmKG-0002E6-BY
	for submit <at> debbugs.gnu.org; Sun, 26 Jan 2020 13:08:00 -0500
Received: from userp2120.oracle.com ([156.151.31.85]:50956)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1ivmKD-0002Dt-VC
 for 39293 <at> debbugs.gnu.org; Sun, 26 Jan 2020 13:07:58 -0500
Received: from pps.filterd (userp2120.oracle.com [127.0.0.1])
 by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00QI3Por094102;
 Sun, 26 Jan 2020 18:07:52 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2019-08-05;
 bh=HyeIXFf3mktblhtELOkzTqPCm0tRJlWj8uBZM5Iyt/k=;
 b=F5y1Ur4Dm+pX8NJvGBKEGSSkaWM0Fv8NoNEdntNoTCcrDqwc3s91eszYE4JP9afU7o4b
 ZJLvs3N8jXAeY6WKLZQMl6OD5ATWLc0AFnzQYLk2lCFkEMMVdrPwPPcUHRVgwplOSZhw
 MxKuqm02x1FmfuTA/lJXUdtByKmBtVGWE3RkR/AhAUg9oef6cHdWlw5RTvKr0aDLUnv+
 qV1SSezk2n/nyzm+6+Z0sKbxqG7u42XWuSxefXfUaObcgpPrXkVN9wdZvF+xsqdsHEZd
 vTxh+TckWTPzgsRRo5QgKbjevmlXdFlVSrG9Dud9AeqFb3vGPrpvSpWc4gLlqbTF52w4 5Q== 
Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70])
 by userp2120.oracle.com with ESMTP id 2xreaqv19r-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Sun, 26 Jan 2020 18:07:52 +0000
Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1])
 by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00QI3gX9065477;
 Sun, 26 Jan 2020 18:05:51 GMT
Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236])
 by aserp3020.oracle.com with ESMTP id 2xry6m2xfu-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Sun, 26 Jan 2020 18:05:51 +0000
Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8])
 by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 00QI5nJC032156;
 Sun, 26 Jan 2020 18:05:50 GMT
MIME-Version: 1.0
Message-ID: <047a219c-5378-4cb6-97bb-e57187324988@default>
Date: Sun, 26 Jan 2020 10:05:48 -0800 (PST)
From: Drew Adams <drew.adams@HIDDEN>
To: Stefan Kangas <stefan@HIDDEN>, 39293 <at> debbugs.gnu.org
Subject: RE: bug#39293: [PATCH] Base bookmark-bmenu-mode on
 'tabulated-list-mode'
References: <87lfpu9ag8.fsf@HIDDEN>
In-Reply-To: <87lfpu9ag8.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4954.0 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9512
 signatures=668685
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-1911140001 definitions=main-2001260158
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9512
 signatures=668685
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-1911140001
 definitions=main-2001260158
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39293
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> The attached patch changes bookmark-bmenu-mode to be based on
> tabulated-list-mode instead of special-mode.
>=20
> This allows us to simplify the code in several cases.  In addition, we
> get many features for free, such as sorting columns by clicking on the
> column headers, changing size of columns.  In the future, this will
> obviously include any new feature added to 'tabulated-list-mode'.
>=20
> The only functional step backwards is that we no longer support the
> optional "inline" header line -- a bookmark.el-specific hack to have a
> header without using 'header-line-format'.  I don't believe this
> feature is very useful since the lack of such support for anything
> similar in e.g. 'package-menu-mode' has not caused any problems.  It
> seems to have been added together with 'header-line-format' as a fire
> escape if the latter caused any problems.
>=20
> I recently added a number of tests to bookmark.el on master, which
> were developed as part of this suggested change.  These tests pass
> using both the new and the old code, which gives some degree of
> confidence in this change.
>=20
> Any comments, objections or suggestions?  Thanks.

I _strongly_ object to this.  And I would say the same
thing if such a suggestion were made for Dired.

If vanilla Emacs does this then I will have to separate
Bookmark+ completely from `bookmark.el', incorporating
its code prior to your change.

I don't want to do that, but I will have to (and it
won't be hard to do - that's not the problem).  Until
now, I've made a concerted effort to be compatible with
vanilla `bookmark.el', for the benefit of users.

It's very wrong to think either that things like the
bookmark-list display and Dired's listings are as
simple as what `tabulated-list-mode' provides, or that
their features can be easily added on top of
`tabulated-list-mode'.

This kind of proposal is, IMO, a consequence of one or
both of the following:

1. Favoring development, or rather maintenance, over
   user convenience, power, and features.

   The imagined gain is a chimera.  The code has been
   used for a very long time, and there is little
   maintenance burden.

2. Not appreciating the specificity of the features
   offered by libraries such as Dired and bookmarking.

   Not being well acquainted with such features, and
   so supposing that they don't exist or they're no
   big deal and not worth bothering about.

   Being acquainted with `tabulated-list-mode', and
   thinking its features are wonderful, abundant, and
   sufficiently general and flexible.

   Consider sorting, as just one example among many
   (yes, many).

   Sorting in Dired or the bookmark list (at least with
   Bookmark+) is _much more_ useful and flexible than
   just sorting columns.  Why?  Because the things
   displayed are of different kinds across rows, not
   just across columns.  The columns, for bookmark-list
   display, are less interesting (this is less true of
   Dired, but the same consideration holds).

   Here are the predefined ways you can sort bookmarks
   with Bookmark+.  And users can easily define their
   own ways of sorting, just as they can define their
   own kinds of bookmarks.

   key     binding
   ---     -------

   s C-r   bmkp-reverse-multi-sort-order
   s *     bmkp-bmenu-sort-modified-before-unmodified
   s 0     bmkp-bmenu-sort-by-creation-time
   s >     bmkp-bmenu-sort-marked-before-unmarked
   s D     bmkp-bmenu-sort-flagged-before-unflagged
   s I     bmkp-bmenu-sort-by-Info-position
   s a     bmkp-bmenu-sort-annotated-before-unannotated
   s b     bmkp-bmenu-sort-by-last-buffer-or-file-access
   s d     bmkp-bmenu-sort-by-last-bookmark-access
   s f d   bmkp-bmenu-sort-by-last-local-file-access
   s f k   bmkp-bmenu-sort-by-local-file-type
   s f n   bmkp-bmenu-sort-by-file-name
   s f s   bmkp-bmenu-sort-by-local-file-size
   s f u   bmkp-bmenu-sort-by-last-local-file-update
   s g     bmkp-bmenu-sort-by-Gnus-thread
   s i     bmkp-bmenu-sort-by-Info-node-name
   s k     bmkp-bmenu-sort-by-bookmark-type
   s n     bmkp-bmenu-sort-by-bookmark-name
   s r     bmkp-reverse-sort-order
   s s     bmkp-bmenu-change-sort-order-repeat
   s t     bmkp-bmenu-sort-tagged-before-untagged
   s u     bmkp-bmenu-sort-by-url
   s v     bmkp-bmenu-sort-by-bookmark-visit-frequency

   What's more, you can combine sort orders - see

https://www.emacswiki.org/emacs/BookmarkPlus#SortingBookmarks

---

May I invite you to please spend your (much-appreciated)
volunteer effort on something else?  This isn't broken,
and your proposal would shatter it.

Do I use `tabulated-list-mode', or am I just grousing,
as an old fart stuck in his ways and unfamiliar with
`tabulated-list-mode'?

Yes, I use it (e.g. in my library `apu.el').  But it
is very limited, and the limitations do not just stem
from a lack of more generic features.  I use it only
when it's appropriate.

There's only so much you will ever be able to get out
of `tabulated-list-mode'.  Apply it so simple listings
that don't need or offer much functionality.  Please
leave the sophisticated, useful listing displays alone.

This is a have-a-hammer-and-see-only-nails story.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39293; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Jan 2020 16:14:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 26 11:14:04 2020
Received: from localhost ([127.0.0.1]:57326 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ivkXz-0005ju-Hc
	for submit <at> debbugs.gnu.org; Sun, 26 Jan 2020 11:14:04 -0500
Received: from lists.gnu.org ([209.51.188.17]:60132)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefan@HIDDEN>) id 1ivkXx-0005jG-Eo
 for submit <at> debbugs.gnu.org; Sun, 26 Jan 2020 11:14:02 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:58340)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <stefan@HIDDEN>) id 1ivkXu-0004bs-JQ
 for bug-gnu-emacs@HIDDEN; Sun, 26 Jan 2020 11:14:01 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: *
X-Spam-Status: No, score=1.9 required=5.0 tests=BAYES_50,DATE_IN_PAST_12_24,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <stefan@HIDDEN>) id 1ivkXr-000325-Th
 for bug-gnu-emacs@HIDDEN; Sun, 26 Jan 2020 11:13:58 -0500
Received: from ted.gofardesign.uk ([67.225.143.91]:57030)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <stefan@HIDDEN>) id 1ivkXr-000312-HA
 for bug-gnu-emacs@HIDDEN; Sun, 26 Jan 2020 11:13:55 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; 
 s=default;
 h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From:
 Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description:
 Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
 In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=srMLbhJIealLy1Eyh2z5rOzS9xcD7Af4mck46tLUbU0=; b=CvoGvXv3+StroyTQy3nB6HBSvw
 EuFEU81WuBEwqxeq+3kC3VEYF/THXI6cN4P7oB5LubK6Gsuw/5OqtxYbQBFNwKlp5NGsuZHFXrPt5
 5U03Q2xyxrSyTDzvfc1ypUPGc8NL4acdzh+XLXZcu4tzx4Dwnxiafen+51ck0edC6eBplJeI3S7Dt
 8VWjQp/zjxGvqG8KqmGg5aqQPWtNrciKPb49vvCEEWv2iw+Dhuzkubd4Z28TC3Y2J53TdkeLv4t/+
 OG5pnSuDlngqB/NoG45jj/d86BNFElX0w0qIXCv51CwBcpoT7LgEtu9hBG7aM49/SpksIaAT1+0js
 5m+HKnUg==;
Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:54200
 helo=localhost)
 by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
 (Exim 4.92) (envelope-from <stefan@HIDDEN>) id 1ivkXq-001Yrg-Ds
 for bug-gnu-emacs@HIDDEN; Sun, 26 Jan 2020 11:13:54 -0500
From: Stefan Kangas <stefan@HIDDEN>
To: bug-gnu-emacs <bug-gnu-emacs@HIDDEN>
Subject: [PATCH] Base bookmark-bmenu-mode on 'tabulated-list-mode'
Date: Sun, 26 Jan 2020 04:13:27 +0100
Message-ID: <87lfpu9ag8.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - ted.gofardesign.uk
X-AntiAbuse: Original Domain - gnu.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - marxist.se
X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id:
 stefan@HIDDEN
X-Authenticated-Sender: ted.gofardesign.uk: stefan@HIDDEN
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 67.225.143.91
X-Spam-Score: 1.1 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  The attached patch changes bookmark-bmenu-mode to be based
 on tabulated-list-mode instead of special-mode. This allows us to simplify
 the code in several cases. In addition, we get many features for free, such
 as sorting columns by clicking on the column headers, changing size of columns.
 In the future, th [...] 
 Content analysis details:   (1.1 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: marxist.se]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.8 DATE_IN_PAST_12_24     Date: is 12 to 24 hours before Received: date
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at https://www.dnswl.org/,
 low trust [209.51.188.17 listed in list.dnswl.org]
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.1 (/)

--=-=-=
Content-Type: text/plain

The attached patch changes bookmark-bmenu-mode to be based on
tabulated-list-mode instead of special-mode.

This allows us to simplify the code in several cases.  In addition, we
get many features for free, such as sorting columns by clicking on the
column headers, changing size of columns.  In the future, this will
obviously include any new feature added to 'tabulated-list-mode'.

The only functional step backwards is that we no longer support the
optional "inline" header line -- a bookmark.el-specific hack to have a
header without using 'header-line-format'.  I don't believe this
feature is very useful since the lack of such support for anything
similar in e.g. 'package-menu-mode' has not caused any problems.  It
seems to have been added together with 'header-line-format' as a fire
escape if the latter caused any problems.

I recently added a number of tests to bookmark.el on master, which
were developed as part of this suggested change.  These tests pass
using both the new and the old code, which gives some degree of
confidence in this change.

Any comments, objections or suggestions?  Thanks.

Best regards,
Stefan Kangas


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Base-bookmark-bmenu-mode-on-tabulated-list-mode.patch

From 92413619fa28043eeab72dab1d7278f482028833 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@HIDDEN>
Date: Sun, 26 Jan 2020 04:06:15 +0100
Subject: [PATCH] Base bookmark-bmenu-mode on 'tabulated-list-mode'

Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode'
allows us to greatly simplify the code in several cases.  In addition,
we get some features for free, such as sorting by column.

The only functional step backwards is that we no longer support the
optional "inline" header line, a bookmark.el-specific feature to have
a header without using 'header-line-format'.  This feature is believed
to be not very useful or widely used.

* lisp/bookmark.el (tabulated-list): Require.
(bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of
'special-mode' and make the necessary changes to support that.
(bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map'
instead of 'special-mode-map'.  Remove now duplicate key bindings.
(bookmark-bmenu--revert): New function to show the bookmark list using
'tabulated-list-mode'.
(bookmark-bmenu-list): Simplify by using above new function.
(bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'.
(bookmark-bmenu--name-predicate)
(bookmark-bmenu--file-predicate): New functions used by
'tabulated-list-mode' to sort.

(bookmark-bmenu-set-header): Redefine as obsolete function alias for
'tabulated-list-init-header'.
(bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames)
(bookmark-bmenu-hide-filenames, bookmark-bmenu-mark)
(bookmark-bmenu-unmark, bookmark-bmenu-delete)
bookmark-bmenu-delete-backwards): Simplify now that we can depend on
'tabulated-list-mode' to do more work.

(bookmark-bmenu-use-header-line)
(bookmark-bmenu-inline-header-height): Declare variables relating to
the now unsupported "inline" header obsolete.
(bookmark-bmenu-ensure-position)
(bookmark-bmenu-execute-deletions): Remove code to handle "inline" header.

* test/lisp/bookmark-tests.el
(bookmark-test-bmenu-edit-annotation/show-annotation)
(bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests
for minor changes when using 'tabulated-list-mode'.
---
 etc/NEWS                    |  10 ++
 lisp/bookmark.el            | 270 ++++++++++++------------------------
 test/lisp/bookmark-tests.el |   4 +
 3 files changed, 105 insertions(+), 179 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index c3a71ade8a..fab6228167 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -87,6 +87,16 @@ line numbers that were previously jumped to.
 
 * Changes in Specialized Modes and Packages in Emacs 28.1
 
+---
+** The 'list-bookmark' menu is now based on 'tabulated-list-mode'.
+The interactive bookmark list will now benefit from features in
+'tabulated-list-mode' like sorting columns or changing column width.
+
+Support for the optional "inline" header line, allowing for a header
+without using 'header-line-format', has been dropped.  Consequently,
+the variables 'bookmark-bmenu-use-header-line' and
+'bookmark-bmenu-inline-header-height' are now declared obsolete.
+
 ---
 ** The sb-image.el library is now marked obsolete.
 This file was a compatibility kludge which is no longer needed.
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 720ad18c16..5722d2f3fd 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -32,6 +32,7 @@
 ;;; Code:
 
 (require 'pp)
+(require 'tabulated-list)
 (require 'text-property-search)
 (eval-when-compile (require 'cl-lib))
 
@@ -126,16 +127,16 @@ bookmark-automatically-show-annotations
 (defconst bookmark-bmenu-buffer "*Bookmark List*"
   "Name of buffer used for Bookmark List.")
 
-(defcustom bookmark-bmenu-use-header-line t
+(defvar bookmark-bmenu-use-header-line t
   "Non-nil means to use an immovable header line.
-This is as opposed to inline text at the top of the buffer."
-  :version "24.4"
-  :type 'boolean)
+This is as opposed to inline text at the top of the buffer.")
+(make-obsolete-variable 'bookmark-bmenu-use-header-line "no longer used." "28.1")
 
 (defconst bookmark-bmenu-inline-header-height 2
   "Number of lines used for the *Bookmark List* header.
 \(This is only significant when `bookmark-bmenu-use-header-line'
 is nil.)")
+(make-obsolete-variable 'bookmark-bmenu-inline-header-height "no longer used." "28.1")
 
 (defconst bookmark-bmenu-marks-width 2
   "Number of columns (chars) used for the *Bookmark List* marks column.
@@ -165,6 +166,7 @@ bookmark-search-delay
   "Time before `bookmark-bmenu-search' updates the display."
   :type  'number)
 
+;; FIXME: Should be declared obsolete.
 (defface bookmark-menu-heading
   '((t (:inherit font-lock-type-face)))
   "Face used to highlight the heading in bookmark menu buffers."
@@ -975,7 +977,7 @@ bookmark-send-edited-annotation
     (when from-bookmark-list
       (pop-to-buffer (get-buffer bookmark-bmenu-buffer))
       (goto-char (point-min))
-      (text-property-search-forward 'bookmark-name-prop bookmark-name))
+      (bookmark-bmenu-bookmark))
     (kill-buffer old-buffer)))
 
 
@@ -1580,7 +1582,7 @@ bookmark-bmenu-hidden-bookmarks
 
 (defvar bookmark-bmenu-mode-map
   (let ((map (make-keymap)))
-    (set-keymap-parent map special-mode-map)
+    (set-keymap-parent map tabulated-list-mode-map)
     (define-key map "v" 'bookmark-bmenu-select)
     (define-key map "w" 'bookmark-bmenu-locate)
     (define-key map "5" 'bookmark-bmenu-other-frame)
@@ -1599,8 +1601,6 @@ bookmark-bmenu-mode-map
     (define-key map "x" 'bookmark-bmenu-execute-deletions)
     (define-key map "d" 'bookmark-bmenu-delete)
     (define-key map " " 'next-line)
-    (define-key map "n" 'next-line)
-    (define-key map "p" 'previous-line)
     (define-key map "\177" 'bookmark-bmenu-backup-unmark)
     (define-key map "u" 'bookmark-bmenu-unmark)
     (define-key map "m" 'bookmark-bmenu-mark)
@@ -1663,6 +1663,30 @@ bookmark-bmenu-surreptitiously-rebuild-list
         (save-window-excursion
           (bookmark-bmenu-list)))))
 
+(defun bookmark-bmenu--revert ()
+  "Re-populate `tabulated-list-entries'."
+  (let (entries)
+    (dolist (full-record (bookmark-maybe-sort-alist))
+      (let* ((name       (bookmark-name-from-full-record full-record))
+             (annotation (bookmark-get-annotation full-record))
+             (location   (bookmark-location full-record)))
+        (push (list
+               full-record
+               `[,(if (and annotation (not (string-equal annotation "")))
+                      "*" "")
+                 ,(if (display-mouse-p)
+                      (propertize name
+                                  'font-lock-face 'bookmark-menu-bookmark
+                                  'mouse-face 'highlight
+                                  'follow-link t
+                                  'help-echo "mouse-2: go to this bookmark in other window")
+                    name)
+                 ,@(if bookmark-bmenu-toggle-filenames
+                       (list location))])
+              entries)))
+    (tabulated-list-init-header)
+    (setq tabulated-list-entries entries))
+  (tabulated-list-print t))
 
 ;;;###autoload
 (defun bookmark-bmenu-list ()
@@ -1676,70 +1700,18 @@ bookmark-bmenu-list
     (if (called-interactively-p 'interactive)
         (switch-to-buffer buf)
       (set-buffer buf)))
-  (let ((inhibit-read-only t))
-    (erase-buffer)
-    (if (not bookmark-bmenu-use-header-line)
-      (insert "% Bookmark\n- --------\n"))
-    (add-text-properties (point-min) (point)
-			 '(font-lock-face bookmark-menu-heading))
-    (dolist (full-record (bookmark-maybe-sort-alist))
-      (let ((name        (bookmark-name-from-full-record full-record))
-            (annotation  (bookmark-get-annotation full-record))
-            (start       (point))
-            end)
-        ;; if a bookmark has an annotation, prepend a "*"
-        ;; in the list of bookmarks.
-        (insert (if (and annotation (not (string-equal annotation "")))
-                    " *" "  ")
-                name)
-        (setq end (point))
-        (put-text-property
-         (+ bookmark-bmenu-marks-width start) end 'bookmark-name-prop name)
-        (when (display-mouse-p)
-          (add-text-properties
-           (+ bookmark-bmenu-marks-width start) end
-           '(font-lock-face bookmark-menu-bookmark
-	     mouse-face highlight
-             follow-link t
-             help-echo "mouse-2: go to this bookmark in other window")))
-        (insert "\n")))
-    (set-buffer-modified-p (not (= bookmark-alist-modification-count 0)))
-    (goto-char (point-min))
-    (bookmark-bmenu-mode)
-    (if bookmark-bmenu-use-header-line
-	(bookmark-bmenu-set-header)
-      (forward-line bookmark-bmenu-inline-header-height))
-    (when (and bookmark-alist bookmark-bmenu-toggle-filenames)
-      (bookmark-bmenu-toggle-filenames t))))
+  (bookmark-bmenu-mode)
+  (bookmark-bmenu--revert))
 
 ;;;###autoload
 (defalias 'list-bookmarks 'bookmark-bmenu-list)
 ;;;###autoload
 (defalias 'edit-bookmarks 'bookmark-bmenu-list)
 
-;; FIXME: This could also display the current default bookmark file
-;; according to `bookmark-bookmarks-timestamp'.
-(defun bookmark-bmenu-set-header ()
-  "Set the immutable header line."
-  (let ((header (concat "%% " "Bookmark")))
-    (when bookmark-bmenu-toggle-filenames
-      (setq header (concat header
-			   (make-string (- bookmark-bmenu-file-column
-					   (- (length header) 3))  ?\s)
-			   "File")))
-    (let ((pos 0))
-      (while (string-match "[ \t\n]+" header pos)
-	(setq pos (match-end 0))
-	(put-text-property (match-beginning 0) pos 'display
-			   (list 'space :align-to (- pos 1))
-			   header)))
-    (put-text-property 0 2 'face 'fixed-pitch header)
-    (setq header (concat (propertize " " 'display '(space :align-to 0))
-			 header))
-    ;; Code derived from `buff-menu.el'.
-    (setq header-line-format header)))
-
-(define-derived-mode bookmark-bmenu-mode special-mode "Bookmark Menu"
+(define-obsolete-function-alias 'bookmark-bmenu-set-header
+  #'tabulated-list-init-header "28.1")
+
+(define-derived-mode bookmark-bmenu-mode tabulated-list-mode "Bookmark Menu"
   "Major mode for editing a list of bookmarks.
 Each line describes one of the bookmarks in Emacs.
 Letters do not insert themselves; instead, they are commands.
@@ -1773,8 +1745,30 @@ bookmark-bmenu-mode
   in another buffer.
 \\[bookmark-bmenu-show-all-annotations] -- show the annotations of all bookmarks in another buffer.
 \\[bookmark-bmenu-edit-annotation] -- edit the annotation for the current bookmark."
-  (setq truncate-lines t)
-  (setq buffer-read-only t))
+  ;; FIXME: The header could also display the current default bookmark file
+  ;; according to `bookmark-bookmarks-timestamp'.
+  (setq tabulated-list-format
+        `[("" 1) ;; Space to add "*" for bookmark with annotation
+          ("Bookmark" ,bookmark-bmenu-file-column bookmark-bmenu--name-predicate)
+          ,@(if bookmark-bmenu-toggle-filenames
+                '(("File" 0 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)'
+  (setq revert-buffer-function 'bookmark-bmenu--revert)
+  (tabulated-list-init-header))
+
+
+(defun bookmark-bmenu--name-predicate (a b)
+  "Predicate to sort \"*Bookmark List*\" buffer by the name column.
+This is used for `tabulated-list-format' in `bookmark-bmenu-mode'."
+  (string< (caar a) (caar b)))
+
+
+(defun bookmark-bmenu--file-predicate (a b)
+  "Predicate to sort \"*Bookmark List*\" buffer by the file column.
+This is used for `tabulated-list-format' in `bookmark-bmenu-mode'."
+  (string< (bookmark-location (car a)) (bookmark-location (car b))))
 
 
 (defun bookmark-bmenu-toggle-filenames (&optional show)
@@ -1783,100 +1777,42 @@ bookmark-bmenu-toggle-filenames
   (interactive)
   (cond
    (show
-    (setq bookmark-bmenu-toggle-filenames nil)
-    (bookmark-bmenu-show-filenames)
     (setq bookmark-bmenu-toggle-filenames t))
    (bookmark-bmenu-toggle-filenames
-    (bookmark-bmenu-hide-filenames)
     (setq bookmark-bmenu-toggle-filenames nil))
    (t
-    (bookmark-bmenu-show-filenames)
     (setq bookmark-bmenu-toggle-filenames t)))
-  (when bookmark-bmenu-use-header-line
-    (bookmark-bmenu-set-header)))
-
-
-(defun bookmark-bmenu-show-filenames (&optional force)
-  "In an interactive bookmark list, show filenames along with bookmarks.
-Non-nil FORCE forces a redisplay showing the filenames.  FORCE is used
-mainly for debugging, and should not be necessary in normal use."
-  (if (and (not force) bookmark-bmenu-toggle-filenames)
-      nil ;already shown, so do nothing
-    (with-buffer-modified-unmodified
-     (save-excursion
-       (save-window-excursion
-         (goto-char (point-min))
-	 (if (not bookmark-bmenu-use-header-line)
-	     (forward-line bookmark-bmenu-inline-header-height))
-         (setq bookmark-bmenu-hidden-bookmarks ())
-         (let ((inhibit-read-only t))
-           (while (< (point) (point-max))
-             (let ((bmrk (bookmark-bmenu-bookmark)))
-               (push bmrk bookmark-bmenu-hidden-bookmarks)
-               (let ((start (line-end-position)))
-                 (move-to-column bookmark-bmenu-file-column t)
-                 ;; Strip off `mouse-face' from the white spaces region.
-                 (if (display-mouse-p)
-                     (remove-text-properties start (point)
-                                             '(mouse-face nil help-echo nil))))
-               (delete-region (point) (progn (end-of-line) (point)))
-               (insert "  ")
-               ;; Pass the NO-HISTORY arg:
-               (bookmark-insert-location bmrk t)
-               (forward-line 1)))))))))
-
-
-(defun bookmark-bmenu-hide-filenames (&optional force)
-  "In an interactive bookmark list, hide the filenames of the bookmarks.
-Non-nil FORCE forces a redisplay showing the filenames.  FORCE is used
-mainly for debugging, and should not be necessary in normal use."
-  (when (and (not force) bookmark-bmenu-toggle-filenames)
-    ;; nothing to hide if above is nil
-    (with-buffer-modified-unmodified
-     (save-excursion
-       (goto-char (point-min))
-       (if (not bookmark-bmenu-use-header-line)
-	   (forward-line bookmark-bmenu-inline-header-height))
-       (setq bookmark-bmenu-hidden-bookmarks
-             (nreverse bookmark-bmenu-hidden-bookmarks))
-       (let ((inhibit-read-only t))
-         (while bookmark-bmenu-hidden-bookmarks
-           (move-to-column bookmark-bmenu-marks-width t)
-           (bookmark-kill-line)
-           (let ((name  (pop bookmark-bmenu-hidden-bookmarks))
-                 (start (point)))
-             (insert name)
-             (put-text-property start (point) 'bookmark-name-prop name)
-             (if (display-mouse-p)
-                 (add-text-properties
-                  start (point)
-                  '(font-lock-face bookmark-menu-bookmark
-		    mouse-face highlight
-		    follow-link t help-echo
-                    "mouse-2: go to this bookmark in other window"))))
-           (forward-line 1)))))))
+  (bookmark-bmenu-surreptitiously-rebuild-list))
+
+
+(defun bookmark-bmenu-show-filenames (&optional _)
+  "In an interactive bookmark list, show filenames along with bookmarks."
+  (setq bookmark-bmenu-toggle-filenames t)
+  (bookmark-bmenu-surreptitiously-rebuild-list))
+
+
+(defun bookmark-bmenu-hide-filenames (&optional _)
+  "In an interactive bookmark list, hide the filenames of the bookmarks."
+  (setq bookmark-bmenu-toggle-filenames nil)
+  (bookmark-bmenu-surreptitiously-rebuild-list))
 
 
 (defun bookmark-bmenu-ensure-position ()
   "If point is not on a bookmark line, move it to one.
-If before the first bookmark line, move to the first; if after the
-last full line, move to the last full line.  The return value is undefined."
-  (cond ((and (not bookmark-bmenu-use-header-line)
-	      (< (count-lines (point-min) (point))
-		 bookmark-bmenu-inline-header-height))
-         (goto-char (point-min))
-         (forward-line bookmark-bmenu-inline-header-height))
-        ((and (bolp) (eobp))
+If after the last full line, move to the last full line.  The
+return value is undefined."
+  (cond ((and (bolp) (eobp))
          (beginning-of-line 0))))
 
 
 (defun bookmark-bmenu-bookmark ()
   "Return the bookmark for this line in an interactive bookmark list buffer."
   (bookmark-bmenu-ensure-position)
-  (save-excursion
-    (beginning-of-line)
-    (forward-char bookmark-bmenu-marks-width)
-    (get-text-property (point) 'bookmark-name-prop)))
+  (let* ((id (tabulated-list-get-id))
+         (entry (and id (assoc id tabulated-list-entries))))
+    (if entry
+        (caar entry)
+      "")))
 
 
 (defun bookmark-show-annotation (bookmark-name-or-record)
@@ -1924,14 +1860,8 @@ bookmark-show-all-annotations
 (defun bookmark-bmenu-mark ()
   "Mark bookmark on this line to be displayed by \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-select]."
   (interactive)
-  (beginning-of-line)
   (bookmark-bmenu-ensure-position)
-  (with-buffer-modified-unmodified
-   (let ((inhibit-read-only t))
-     (delete-char 1)
-     (insert ?>)
-     (forward-line 1)
-     (bookmark-bmenu-ensure-position))))
+  (tabulated-list-put-tag ">" t))
 
 
 (defun bookmark-bmenu-select ()
@@ -2082,17 +2012,12 @@ bookmark-bmenu-unmark
   "Cancel all requested operations on bookmark on this line and move down.
 Optional BACKUP means move up."
   (interactive "P")
-  (beginning-of-line)
+  ;; any flags to reset according to circumstances?  How about a
+  ;; flag indicating whether this bookmark is being visited?
+  ;; well, we don't have this now, so maybe later.
   (bookmark-bmenu-ensure-position)
-  (with-buffer-modified-unmodified
-   (let ((inhibit-read-only t))
-     (delete-char 1)
-     ;; any flags to reset according to circumstances?  How about a
-     ;; flag indicating whether this bookmark is being visited?
-     ;; well, we don't have this now, so maybe later.
-     (insert " "))
-   (forward-line (if backup -1 1))
-   (bookmark-bmenu-ensure-position)))
+  (tabulated-list-put-tag " ")
+  (forward-line (if backup -1 1)))
 
 
 (defun bookmark-bmenu-backup-unmark ()
@@ -2109,14 +2034,8 @@ bookmark-bmenu-delete
   "Mark bookmark on this line to be deleted.
 To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]."
   (interactive)
-  (beginning-of-line)
   (bookmark-bmenu-ensure-position)
-  (with-buffer-modified-unmodified
-   (let ((inhibit-read-only t))
-     (delete-char 1)
-     (insert ?D)
-     (forward-line 1)
-     (bookmark-bmenu-ensure-position))))
+  (tabulated-list-put-tag "D" t))
 
 
 (defun bookmark-bmenu-delete-backwards ()
@@ -2124,10 +2043,7 @@ bookmark-bmenu-delete-backwards
 To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]."
   (interactive)
   (bookmark-bmenu-delete)
-  (forward-line -2)
-  (bookmark-bmenu-ensure-position)
-  (forward-line 1)
-  (bookmark-bmenu-ensure-position))
+  (forward-line -2))
 
 
 (defun bookmark-bmenu-execute-deletions ()
@@ -2143,8 +2059,6 @@ bookmark-bmenu-execute-deletions
                        (progn (end-of-line) (point))))))
         (o-col     (current-column)))
     (goto-char (point-min))
-    (unless bookmark-bmenu-use-header-line
-      (forward-line 1))
     (while (re-search-forward "^D" (point-max) t)
       (bookmark-delete (bookmark-bmenu-bookmark) t)) ; pass BATCH arg
     (bookmark-bmenu-list)
@@ -2269,8 +2183,6 @@ bookmark-menu-popup-paned-menu
 ;; We MUST autoload EACH form used to set up this variable's value, so
 ;; that the whole job is done in loaddefs.el.
 
-;; Emacs menubar stuff.
-
 ;;;###autoload
 (defvar menu-bar-bookmark-map
   (let ((map (make-sparse-keymap "Bookmark functions")))
diff --git a/test/lisp/bookmark-tests.el b/test/lisp/bookmark-tests.el
index b9c6ff9c54..ab85a94f3d 100644
--- a/test/lisp/bookmark-tests.el
+++ b/test/lisp/bookmark-tests.el
@@ -361,6 +361,8 @@ bookmark-test-bmenu-send-edited-annotation/restore-focus
    (insert "foo")
    (bookmark-send-edited-annotation)
    (should (equal (buffer-name (current-buffer)) bookmark-bmenu-buffer))
+   (beginning-of-line)
+   (forward-char 4)
    (should (looking-at "name"))))
 
 (ert-deftest bookmark-test-bmenu-toggle-filenames ()
@@ -393,6 +395,7 @@ bookmark-test-bmenu-bookmark
 (ert-deftest bookmark-test-bmenu-mark ()
   (with-bookmark-bmenu-test
    (bookmark-bmenu-mark)
+   (forward-line -1)
    (beginning-of-line)
    (should (looking-at "^>"))))
 
@@ -407,6 +410,7 @@ bookmark-test-bmenu-unmark
    (bookmark-bmenu-mark)
    (goto-char (point-min))
    (bookmark-bmenu-unmark)
+   (forward-line -1)
    (beginning-of-line)
    (should (looking-at "^  "))))
 
-- 
2.20.1


--=-=-=--




Acknowledgement sent to Stefan Kangas <stefan@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#39293; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 27 Feb 2020 13:00:02 UTC

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