emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Friendlier dired experience [CODE INCLUDED]


From: Adam Porter
Subject: Re: Friendlier dired experience [CODE INCLUDED]
Date: Thu, 05 Nov 2020 10:18:51 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> You'd still have the downside that the general bookmarks include all the
>>> other non-directory bookmarks, so maybe it's not a good idea anyway.
>>> [ I'm not using bookmarks very much, so my intuition here is poor.  ]
>> Why would that be a downside?
>
> That you can have name conflicts between the diredc and other bookmarks,
> and that when selecting a diredc bookmark you'd have to see all those
> other bookmarks which might make it more timeconsuming to find the
> bookmark you're after.
>
> For the first problem, I don't have a good solution.
> For the second, I think this actually hints at a need for the generic
> bookmark-selection functionality to offer a way to first select a *type*
> of bookmark and only then pick a name among the remaining candidates.
>
> [ And of course, in the absence of such generic support in bookmark.el,
>   diredc could do it on its own by offer a command which pre-filters
>   the list of bookmarks to only include those which refer to
>   directories.  ]

Some recent work I've done in Burly[0] touches on this.

Because Burly uses its own bookmark handler function, it was easy to
write a command that offers only bookmarks created with Burly by
filtering them on the bookmark records' handler value.[1]

However, when I tried to write a bookmark-listing command to display
only Burly's bookmarks, it wasn't as easy to re-use existing
functionality.  I tried to re-use the list-bookmarks command by binding
bookmarks-alist to a filtered alist, and that worked.

The problem is that re-displaying the bookmarks list (e.g. after
deleting a bookmark) shows the non-filtered bookmarks list.  I then
experimented with using buffer-local function advice in the
list-bookmarks buffer to cause it to use the filtered bookmarks list
when re-displaying, but it didn't seem to work.  And even if it had, it
would have been very hacky, so it didn't seem like a good solution.

An idea I had was for the list-bookmarks command to use an optional
filter function to filter the bookmarks-alist before displaying them, so
the filter could persist after using commands to manipulate
bookmarks.[2] (Note that the global value of bookmarks-alist would
remain unchanged so that saving the bookmarks to disk still saves all
bookmarks, not just the filtered ones.)

Frankly, I wonder if list-bookmarks ought to be rewritten to use,
e.g. tabulated-list-mode instead of its bespoke code.  (Although I'm
guessing that would break much of Drew's Bookmarks+ library...)

0: https://github.com/alphapapa/burly.el
1: 
https://github.com/alphapapa/burly.el/blob/e2ab1b2526ce84ad7dd17bf37c0079785619bc8e/burly.el#L156
2: https://github.com/alphapapa/burly.el/issues/14#issuecomment-719803053




reply via email to

[Prev in Thread] Current Thread [Next in Thread]