~protesilaos/general-issues

2 2

dired-preview: preview directories? (Plus suggestion)

Karthik Chikmagalur <contact@karthinks.com>
Details
Message ID
<87pm5cnpaf.fsf@gmail.com>
DKIM signature
missing
Download raw message
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
Details
Message ID
<87jzvhbcam.fsf@protesilaos.com>
In-Reply-To
<87pm5cnpaf.fsf@gmail.com> (view parent)
DKIM signature
missing
Download raw message
> 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
Details
Message ID
<ypi9sf4wy4p1.fsf@gmail.com>
In-Reply-To
<87jzvhbcam.fsf@protesilaos.com> (view parent)
DKIM signature
missing
Download raw message
Another idea could be to just use the output of `ls -l` or `exa -l`
Reply to thread Export thread (mbox)