protesilaos / dired-preview

Automatically preview file at point in Emacs Dired.
GNU General Public License v3.0
57 stars 2 forks source link

Add a variable to set the width of the Preview pane #3

Closed ronniedroid closed 1 year ago

ronniedroid commented 1 year ago

Right now the preview pane is set to a default width.

Make the preview pane width optional using a variable.

ronniedroid commented 1 year ago

I am actually working on this, I made a custom variable named dired-preview-window-width which I am using inside the dired-preview-display-action-alist like so

(defcustom dired-preview-display-action-alist
  `((display-buffer-in-side-window)
    (side . right)
    (slot . -1)
    (window-width . ,dired-preview-window-width)
    (dedicated . t)
    ....

and it works well when I use either setq or customize-set-variable but only after a restart, not after evaluating the value, which means if the value is changed using the graphical customization interface, it won't be applied correctly until a restart to emacs. How can I fix this? will I need to use a hook?

I am sorry for my newbie question, this is my fist elisp contribution.

protesilaos commented 1 year ago

Hi @ronniedroid! This is covered by the user option dired-preview-display-action-alist-function. Granted, it is for experienced users. I have not yet decided how best to make it accessible to less experienced users: it won't be easy, given that display-buffer is inherently complex.

At any rate, the primary goal at this stage is to have a stable core. The extra features will be added later.

ronniedroid commented 1 year ago

Then I will wait for the stable version to come out then come back to this again.

protesilaos commented 1 year ago

As I noted before, there is a customisation option that covers this need. This can be closed now.