emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dired-preview 411a6fd360: CHANGE dired-preview-display-


From: ELPA Syncer
Subject: [elpa] externals/dired-preview 411a6fd360: CHANGE dired-preview-display-action-alist-function to dired-preview-display-action-alist
Date: Mon, 5 Aug 2024 06:58:06 -0400 (EDT)

branch: externals/dired-preview
commit 411a6fd3608a42a5cb5a166ed9613366f426b664
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    CHANGE dired-preview-display-action-alist-function to 
dired-preview-display-action-alist
---
 README.org       |  6 +++---
 dired-preview.el | 37 +++++++++++++++++++++++++++----------
 2 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/README.org b/README.org
index 7b7ecf9ec6..f4163e97ff 100644
--- a/README.org
+++ b/README.org
@@ -153,8 +153,8 @@ This key map binds the following commands:
 :CUSTOM_ID: h:25135eb2-04a9-403e-bc3a-8ee287ac36cf
 :END:
 
-#+vindex: dired-preview-display-action-alist-function
-The user option ~dired-preview-display-action-alist-function~
+#+vindex: dired-preview-display-action-alist
+The user option ~dired-preview-display-action-alist~
 speficies a function to handle the display of the preview.  The
 default value will place the preview either to the right or the
 bottom side window, depending on the available width.
@@ -168,7 +168,7 @@ Users can specify their own conditions with something like 
this:
     (side . right)
     (width . 0.3)))
 
-(setq dired-preview-display-action-alist-function 
#'my-dired-preview-to-the-right)
+(setq dired-preview-display-action-alist #'my-dired-preview-to-the-right)
 #+end_src
 
 Note that the ~display-buffer~ mechanism is inherently complex and
diff --git a/dired-preview.el b/dired-preview.el
index 6c8e138e2c..f47a708a51 100644
--- a/dired-preview.el
+++ b/dired-preview.el
@@ -103,14 +103,28 @@ user option."
   :group 'dired-preview
   :type 'natnum)
 
-(defcustom dired-preview-display-action-alist-function
+(define-obsolete-variable-alias
+  'dired-preview-display-action-alist-function
+  'dired-preview-display-action-alist
+  "0.3.0")
+
+(defcustom dired-preview-display-action-alist
   #'dired-preview-display-action-alist-dwim
-  "Function to return the `display-buffer' action for the preview.
+  "The `display-buffer' action alist for the preview window.
 This is the same data that is passed to `display-buffer-alist'.
 Read Info node `(elisp) Displaying Buffers'.  As such, it is
-meant for experienced users.  See the reference function
-`dired-preview-display-action-alist-dwim' for the implementation
-details."
+meant for experienced users.
+
+Example of a valid value:
+
+    \\='((display-buffer-in-side-window)
+      (side . bottom)
+      (window-height . 0.2)
+      (preserve-size . (t . t)))
+
+The value may also be a function, which returns a `display-buffer'
+action alist.  See `dired-preview-display-action-alist-dwim' for the
+implementation details."
   :group 'dired-preview
   :type 'function)
 
@@ -498,7 +512,7 @@ checked against `split-width-threshold' or
     `(:side bottom :dimension window-height :size 
,(dired-preview-get-window-size :height))))
 
 (defun dired-preview-display-action-alist-dwim ()
-  "Reference function for `dired-preview-display-action-alist-function'.
+  "Reference function for `dired-preview-display-action-alist'.
 Return a `display-buffer' action alist, as described in the
 aforementioned user option."
   (let ((properties (dired-preview-display-action-side)))
@@ -546,10 +560,13 @@ aforementioned user option."
 (defun dired-preview--display-buffer (buffer)
   "Call `display-buffer' for BUFFER.
 Only do it with the current major mode is Dired."
-  (display-buffer
-   buffer
-   (funcall (or dired-preview-display-action-alist-function
-                #'dired-preview-display-action-alist-dwim))))
+  (let ((action-alist (cond
+                       ((functionp dired-preview-display-action-alist)
+                        (funcall dired-preview-display-action-alist))
+                       (dired-preview-display-action-alist)
+                       (t
+                        (dired-preview-display-action-alist-dwim)))))
+    (display-buffer buffer action-alist)))
 
 (defun dired-preview-display-file (file)
   "Display preview of FILE if appropriate."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]