Hi Prot,
Is there some reason you don't preview directories? It seems like a natural fit for dired-preview to show directory previews along with files. I've enabled it (by removing `(not file-directory-p)' from `dired-preview--preview-p') and it's quite useful.
Suggestion: replace `file-exists-p' in `dired-preview--preview-p' with `file-regular-p'. This works like `file-exists-p' on non-existent files, but additionally returns nil for special files (sockets, block devices etc) that we should not try to preview anyway.
Karthik
> From: Karthik Chikmagalur <contact@karthinks.com>
> Date: Fri, 30 Jun 2023 23:01:28 -0700
>
> Hi Prot,
Hello Karthik,
> Is there some reason you don't preview directories? It seems like a
> natural fit for dired-preview to show directory previews along with
> files. I've enabled it (by removing `(not file-directory-p)' from
> `dired-preview--preview-p') and it's quite useful.
I had it disabled because if the user clicks on the preview window, the
concept of "close outside Dired" does not work. I need to check how
best to handle that scenario.
At any rate, the idea is fine and the use-case should be covered in the
final package. Things are still in a state of flux though, as I am
making lots of changes to eliminate all undesired patterns of behaviour.
> Suggestion: replace `file-exists-p' in `dired-preview--preview-p' with
> `file-regular-p'. This works like `file-exists-p' on non-existent
> files, but additionally returns nil for special files (sockets, block
> devices etc) that we should not try to preview anyway.
Ah yes, this is right!
All the best,
Prot
--
Protesilaos Stavrou
https://protesilaos.com