~protesilaos/general-issues

3 2

dired-preview: dired-preview-trigger fix

Karthik Chikmagalur <contact@karthinks.com>
Details
Message ID
<87sfab8ixn.fsf@gmail.com>
DKIM signature
permerror
Download raw message
Hi Prot,

Just a heads up that `dired-preview-trigger' does not work as intended:

(defun dired-preview-trigger ()
  "Trigger display of file at point after `dired-preview-trigger-commands'."
  (when (memq last-command dired-preview-trigger-commands)
    (dired-preview-display-file)))

Since this is on `post-command-hook', we should be checking
`this-command' against `dired-preview-trigger-commands', not
`last-command'.  Right now it matches against the previous command and
does not update the preview if you are doing anything other than
pressing `n' and `p' continuously.

Karthik
Details
Message ID
<87y1k3xrps.fsf@protesilaos.com>
In-Reply-To
<87sfab8ixn.fsf@gmail.com> (view parent)
DKIM signature
pass
Download raw message
> From: Karthik Chikmagalur <contact@karthinks.com>
> Date: Wed, 28 Jun 2023 12:51:00 -0700
>
> Hi Prot,

Hello Karthik,

> Just a heads up that `dired-preview-trigger' does not work as intended:
>
> (defun dired-preview-trigger ()
>   "Trigger display of file at point after `dired-preview-trigger-commands'."
>   (when (memq last-command dired-preview-trigger-commands)
>     (dired-preview-display-file)))
>
> Since this is on `post-command-hook', we should be checking
> `this-command' against `dired-preview-trigger-commands', not
> `last-command'.  Right now it matches against the previous command and
> does not update the preview if you are doing anything other than
> pressing `n' and `p' continuously.

Oh, right!  Do you want to send a patch?

All the best,
Prot

-- 
Protesilaos Stavrou
https://protesilaos.com
Karthik Chikmagalur <contact@karthinks.com>
Details
Message ID
<87mt0j8h31.fsf@gmail.com>
In-Reply-To
<87y1k3xrps.fsf@protesilaos.com> (view parent)
DKIM signature
permerror
Download raw message
> Oh, right!  Do you want to send a patch?

Since this is a one-sexp fix, please go ahead and make the change.

Karthik
Details
Message ID
<87pm5fxr1h.fsf@protesilaos.com>
In-Reply-To
<87mt0j8h31.fsf@gmail.com> (view parent)
DKIM signature
pass
Download raw message
> From: Karthik Chikmagalur <contact@karthinks.com>
> Date: Wed, 28 Jun 2023 13:30:58 -0700
>
>> Oh, right!  Do you want to send a patch?
>
> Since this is a one-sexp fix, please go ahead and make the change.

Done.  Thank you!

-- 
Protesilaos Stavrou
https://protesilaos.com
Reply to thread Export thread (mbox)