~protesilaos/dired-preview

Revert "Remove alist for 'display-buffer'"

This reverts commit 06f85ad8188a9b7ab4e815afe66df50e1f2ec637.

I have not had time to work on the alternative to this. Better bring
it back until I can revisit this project in earnest. Controlling the
display-buffer in some "smart" way is better than nothing, given that
the absence of this results in an unpleasant experience while
previewing files.
Update dired-preview--display-buffer doc string; add TODO
Reposition dired-preview--add-truncation-message
Move hexl declarations closer to where they are first used
Put dired-preview-mode-map close to the minor mode definition
Add dired-preview-mode-map doc string
Tweak dired-preview-mode-map format
Make dired-preview-chunk-size :type a natnum
Declare optional ARG of hexl-mode-exit
Remove alist for 'display-buffer'

The idea is to simplify how we preview buffers.  The alist should be
handled by the user, anyway.

Check the discussion on the mailing list, with Karthik Chikmagalur:
<https://lists.sr.ht/~protesilaos/general-issues/%3C87tts8cgy1.fsf%40gmail.com%3E>.
Reword dired-preview-start doc string
Make dired-preview-ignored-extensions-regexp accept a nil value
dired-preview: View binary files in hexl-mode

* dired-preview.el (dired-preview-hexl-toggle, dired-preview--find-large-file,
dired-preview-binary-as-hexl): Large files recognized by Emacs as
non-text (binary) are previewed using `hexl-mode'. This is generally preferable
to viewing the raw byte stream in a buffer.

The variable `dired-preview-binary-as-hexl' controls the default
behavior.

At any time, the user can toggle between the raw/text view and
hexl-mode view of a preview buffer by invoking
`dired-preview-hexl-toggle', which is bound to `C-c C-c' in
`dired-preview-mode-map'.
dired-preview: Add support for large file preview

* dired-preview.el (dired-preview--kill-large-buffers,
dired-preview--preview-p, dired-preview--add-to-previews,
dired-preview--chunk-size, dired-preview--find-large-file,
dired-preview--add-truncation-message,
dired-preview--large-files-alist, dired-preview--dispatch-file,
dired-preview--display-buffer): Preview files larger than
`dired-preview-max-size' by reading in only a leading chunk of
data. The size of this chunk is specified by
`dired-preview--chunk-size'.

The function `dired-preview--dispatch-file' is used to determine
how a file should be previewed.  Currently it distinguishes
between large files and not-large files, but this will be expanded
in the future to handle media previews, etc.

The function `dired-preview--find-large-file' is responsible for
setting up the preview.  The corresponding buffer is in
fundamental mode, set to read-only mode with undo disabled.  The
function `dired-preview--add-truncation-message' inserts a message
at the end of the previewed chunk.

In this process,
- the large file cannot be marked as being visited,
- `delayed-mode-hooks' is nil, and
- the buffer is modified,
thus we cannot use the criteria used for regular previews to find
buffers showing previews of large files.  We instead maintain a
separate list, `dired-preview--large-files-alist', to track them.
Merge pull request #8 from Nofint/main

Add more motion commands to trigger-command and close preview windows when point is not on supported files
Add more motion commands to trigger-command and close preview windows when point is not on supported files
Add more motion commands to trigger-command and close preview windows when point is not on supported files
trigger dired-preview by checking if line number is changed rather than using last-command
Remove dired-preview-trigger-commands
Acknowledge user Nofint for commit b3cf4dc

The change is small and does not require the assignment of copyright
to the Free Software Foundation.
Next