joostkremers/ebib

Feature request: use filtering apparatus to mark entries

Hugo-Heagren opened this issue · 1 comments

Today I wanted to push all entries matching a predicate to a dependant database. I filtered my main database, then marked all entries, then tried to push (this actually doesn't work, see #223). But it struck me that there isn't a command to mark by a predicate. Lots of similar list-interface programs have something like mark-by-regexp. There is a already a very powerful apparatus for checking entries against predicates in ebib (much better than just a regexp) in the filtering system. I think it would be cool if we could leverage all of that in marking entries. Users could have all the power of self-defined filters and logical operators.

I'm not exactly sure how this would work though. Maybe a command ebib-mark-by-filter, that lets you choose a filter-predicate (a user-defined filter or a field) and then progress as normal filtering would, but by marking instead?

There is already a way to achieve this, but it's not very obvious, UI-wise. You can create or run your filter, then press C-u m to mark all entries and then cancel the filter with c. The marked entries will stay marked when you cancel the filter, so you end up with a set of marked entries based on a filter.

I agree, though, that the UI could stand some improvement... It'd be nice if updating the filter would update the marked entries as well, without having to go through the extra step of filtering the database.

The easiest way to implement this would be to add some global flag indicating what the user is using the filter for: marking entries or filtering the database. Then modify ebib--update-index-buffer and ebib--list-keys to respect this flag.

That feels kinda hackish, though, so I'm not sure it would be the best solution. Ideas welcome.