Hi,
and thank you for dired-preview. I love it.
Some (many) file types don't have a useful text representation.
For those files it would be nice if we could instead get some metadata
in the preview window.
I imagine the user configuring something like this:
mp3 -> mp3info
png, jpg -> exiv2
pdf -> pdfinfo
Do you think that this might be within the scope of dired-preview?
All the best,
Kaligule
> From: Johannes Lippmann <code@schauderbasis.de>> Date: Thu, 16 Nov 2023 22:09:39 +0100>> Hi,
Hello Kaligule,
> and thank you for dired-preview. I love it.
You are welcome!
> Some (many) file types don't have a useful text representation.> For those files it would be nice if we could instead get some metadata > in the preview window.> I imagine the user configuring something like this:>> mp3 -> mp3info> png, jpg -> exiv2> pdf -> pdfinfo>> Do you think that this might be within the scope of dired-preview?
Yes, this is what we have to do. The only blocker right is my
availability. I have not had time/electricity to work on this package. I
hope to do this soon.
What we need is to introduce new methods to substantiate how a file is
to be opened/previewed/visited/retrieved. Once we have the
infrastructure in place, then we can add whatever glue code to connect
with those system binaries.
All the best,
Protesilaos (or simply "Prot")
--
Protesilaos Stavrou
https://protesilaos.com
>> Some (many) file types don't have a useful text representation.>> For those files it would be nice if we could instead get some metadata >> in the preview window.>> I imagine the user configuring something like this:>>>> mp3 -> mp3info>> png, jpg -> exiv2>> pdf -> pdfinfo>>>> Do you think that this might be within the scope of dired-preview?>> Yes, this is what we have to do. The only blocker right is my> availability. I have not had time/electricity to work on this package. I> hope to do this soon.>> What we need is to introduce new methods to substantiate how a file is> to be opened/previewed/visited/retrieved. Once we have the> infrastructure in place, then we can add whatever glue code to connect> with those system binaries.
I think we can do better than showing metadata: we can switch between
previewing media (images, thumbnails, pdfs) and metadata with C-c C-c,
the way we now switch between raw and hexl views of binary files in
dired-preview.
Prot, what do you think about working on a generic `file-preview'
library for Emacs that makes this easy? The reasons I propose a separate
library are the following:
1. Previews of various MIMEtypes are useful in multiple places in Emacs.
In addition to dired-preview, Org-mode can use it to preview standalone
links (that are not images), for example. Consult can use it for its
previews. Even for images, file-preview can provide thumbnails for
large images that don't play well with Emacs' display engine. (Any
photograph taken on a modern smartphone will bring Emacs to its knees.)
2. We can avoid duplication of effort for each of these applications.
Dirvish already contains a rich and full-featured preview library that
is completely unusable to anyone who hasn't bought into all of Dirvish
as a replacement for dired.
3. file-preview can live in GNU ELPA, and can be used by dired-preview
as an optional dependency. This will also keep dired-preview small,
and folks who don't care about media previews don't have to install it.
Alternatively, we could add the required features to doc-view. I have
looked into doing this, but the problem is the following:
While doc-view is asynchronous, it converts documents in their entirety.
This means previewing a 100 page docx file with doc-view is both slow
and wasteful, since all 100 pages are converted to images. For
dired-preview we only need the first few pages to show up, or (even
better) pages to be converted on demand, if the user scrolls down in the
preview window with the mouse or `scroll-other-window'. Adding the
incremental conversion feature to doc-view seems quite difficult.
Adding it to the tentative `file-preview' library is simpler.
We will also have to submit it to emacs-devel, which is a protracted
process.
Finally, Daniel Mendler has expressed some interest in a generic
`file-preview' feature for Emacs, but I'm not sure he can contribute
time:
https://github.com/minad/consult/issues/863#issuecomment-1751408009
Karthik
> From: Karthik Chikmagalur <contact@karthinks.com>> Date: Fri, 29 Dec 2023 20:05:00 -0800> [... 21 lines elided]> I think we can do better than showing metadata: we can switch between> previewing media (images, thumbnails, pdfs) and metadata with C-c C-c,> the way we now switch between raw and hexl views of binary files in> dired-preview.>> Prot, what do you think about working on a generic `file-preview'> library for Emacs that makes this easy? The reasons I propose a separate> library are the following: >> [... 31 lines elided]>> Finally, Daniel Mendler has expressed some interest in a generic> `file-preview' feature for Emacs, but I'm not sure he can contribute> time:> https://github.com/minad/consult/issues/863#issuecomment-1751408009
I am in favour of it. Though I cannot type at length these days, which
makes it difficult to make contributions. This package is in its initial
release exactly because of this.
--
Protesilaos Stavrou
https://protesilaos.com