dired-hacks icon indicating copy to clipboard operation
dired-hacks copied to clipboard

Better integration with `dired-details` invisible properties

Open nnicandro opened this issue 5 years ago • 3 comments

For the filter groups, the approach is to take advantage of the add-to-invisibility-spec and remove-from-invisibility-spec functions when toggling the filter groups. The semantics of buffer-invisibility-spec allow the invisible property of some text to be a list of symbols and if one of those symbols is a symbol in buffer-invisibility-spec, the text is invisible.

This allows us to, instead of overwriting the invisible property, upgrade it to a list of symbols thereby preserving any invisibility symbols already present. This is what the new function dired-utils-fillin-invisible-property does. Our own invisibility symbol is filled in when dired-filter-group--apply is called and the visibility of the group can be toggled by adding and removing the symbol from the invisibility spec.

For dired-narrow, the new function dired-utils-remove-invisible-property is used which removes a specific invisibility symbol while preserving any other ones. When the narrowed state is updated, one of dired-utils-fillin-invisible-property or dired-utils-remove-invisible-property is called depending on if the current line passes the filter predicate. Since no text properties are overwritten, there is no need to call dired-insert-set-properties.

nnicandro avatar Sep 21 '18 00:09 nnicandro