[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/filechooser 20211f48b5 13/23: Variables to change how f
From: |
ELPA Syncer |
Subject: |
[elpa] externals/filechooser 20211f48b5 13/23: Variables to change how files are chosen |
Date: |
Sun, 4 Feb 2024 12:58:35 -0500 (EST) |
branch: externals/filechooser
commit 20211f48b5298bbd56fe29fa53d468a6eb73e295
Author: Rahguzar <rahguzar@zohomail.eu>
Commit: Rahguzar <rahguzar@zohomail.eu>
Variables to change how files are chosen
---
filechooser.el | 35 ++++++++++++++++++++++++++---------
1 file changed, 26 insertions(+), 9 deletions(-)
diff --git a/filechooser.el b/filechooser.el
index 018b37776a..cb72ae7992 100644
--- a/filechooser.el
+++ b/filechooser.el
@@ -67,6 +67,21 @@ NAME should describe the filter which can either be a regexp
or else a predicate function which takes a filename as argument.
If BOOL is non-nil filter is active by default otherwise it is inactive.")
+(defvar filechooser-choose-file #'filechooser-read-file-name
+ "Function used to choose a single file.
+It should have the same calling calling convention as
+`filechooser--read-file-name-1' which see for expected behavior.")
+
+(defvar filechooser-choose-files #'filechooser-with-dired
+ "Function used to choose multiple files.
+It should have the same calling as `filechooser-with-dired' which see for
+expected behavior.")
+
+(defvar filechooser-choose-directory #'filechooser-save-files
+ "Function used to choose a directory for saving files in.
+It should have the same calling convention as
+`filechooser-save-files' which see for expected behavior.")
+
(defvar filechooser--filters nil)
(defvar filechooser--selection (list (make-temp-file "filechooser-selection-"
t)))
@@ -223,7 +238,7 @@ MUSTMATCH and DIR are as in `read-file-name'. DEFAULT is
the default filename."
result
(filechooser--handle-exisiting-file result dir filters))))
-(defun filechooser-read-file-name (prompt &optional mustmatch filters dir
default)
+(defun filechooser-read-file-name (prompt &optional dir filters mustmatch
default)
"Read a file name.
If `filechooser-use-popup-frame' is non-nil a new minibuffer only popup frame
is used, othewise the selected frame is used.
@@ -361,7 +376,7 @@ editing session. FILTERS are in the format of
`filechooser-filters'."
(forward-line))
`(jit-lock-bounds ,beg . ,end))
-(defun filechooser-with-dired (&optional dir filters)
+(defun filechooser-with-dired (_prompt &optional dir filters)
"Select some files using Dired.
If `filechooser-use-popup-frame' is non-nil a new frame is used for selection,
otherwise selected frame is used. DIR is the directory for initial Dired
@@ -375,31 +390,33 @@ buffer. FILTERS are used to restrict selection to a
subset of files."
(let ((filters (filechooser--make-filters opts)))
(filechooser--return-value
(if (caar (alist-get "multiple" opts nil nil #'equal))
- (filechooser-with-dired nil filters)
- (filechooser-read-file-name (format "%s: " title) t filters)))))
+ (funcall filechooser-choose-files (format "%s: " title) nil filters)
+ (funcall filechooser-choose-file (format "%s: " title) nil filters
t)))))
(defun filechooser-handle-save-file (_handle _app_id _parent title &rest opts)
"Handle SaveFile request with prompt TITLE and options OPTS."
(setq opts (or (plist-get opts :array) (car opts)))
(filechooser--return-value
- (filechooser-read-file-name
- (format "%s: " title) nil
- (filechooser--make-filters opts)
+ (funcall
+ filechooser-choose-file
+ (format "%s: " title)
(file-name-as-directory
(dbus-byte-array-to-string
(butlast (caar (alist-get "current_folder" opts nil nil #'equal)))))
+ (filechooser--make-filters opts) nil
(caar (alist-get "current_name" opts nil nil #'equal)))))
(defun filechooser-handle-save-files (_handle _app_id _parent title &rest opts)
"Handle SaveFiles request with prompt TITLE and options OPTS."
(setq opts (or (plist-get opts :array) (car opts)))
(filechooser--return-value
- (filechooser-save-files
+ (funcall
+ filechooser-choose-directory
(format "%s: " title)
(dbus-byte-array-to-string
(butlast (caar (alist-get "current_folder" opts nil nil #'equal)))
(mapcar (lambda (file) (dbus-byte-array-to-string (butlast file)))
- (caar (alist-get "files" opts nil nil #'equal)))))))
+ (caar (alist-get "files" opts nil nil #'equal)))))))
;;; Starting Service
;;;###autoload
- [elpa] externals/filechooser 601c7c034c 09/23: Track selected files in a separate dired buffer, (continued)
- [elpa] externals/filechooser 601c7c034c 09/23: Track selected files in a separate dired buffer, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser dc246a2655 15/23: Add a completing-read in a loop filechooser, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser e428b5f2d4 23/23: Documentation fixes, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 8c2c93a8b0 05/23: Add readme, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 83010806c3 07/23: Peek a little into the invisible region to nudge jit-lock, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 3669426f04 08/23: Move provide to the end, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser d98a85f9d6 02/23: Add portal and service files, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 651ce0c440 06/23: Make directories filter work in dired, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 676043fd0d 12/23: Make new frames optional, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 9c1c61170f 11/23: Select the selection window only if it exists, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 20211f48b5 13/23: Variables to change how files are chosen,
ELPA Syncer <=
- [elpa] externals/filechooser 2d4dc14a09 16/23: Put the filechooser command in a variable, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 192aec343f 21/23: Remove the crm based chooser, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 282bb2da3c 22/23: Command to select all of current candidates, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 8895cb4ccc 18/23: Bind minibuffer-completing-file-name, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 2582aef0db 17/23: Add a keymap for multiple selection, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 21a567dd32 19/23: Update documentation, ELPA Syncer, 2024/02/04
- [elpa] externals/filechooser 30150e9445 20/23: Use defcustom for customizable variables, ELPA Syncer, 2024/02/04