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

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

[elpa] externals/filechooser 192aec343f 21/23: Remove the crm based choo


From: ELPA Syncer
Subject: [elpa] externals/filechooser 192aec343f 21/23: Remove the crm based chooser
Date: Sun, 4 Feb 2024 12:58:36 -0500 (EST)

branch: externals/filechooser
commit 192aec343f6bdd724a0653c490e43f035adafc66
Author: Rahguzar <rahguzar@zohomail.eu>
Commit: Rahguzar <rahguzar@zohomail.eu>

    Remove the crm based chooser
    
    Because completing read in a loop is more user friendly.
---
 filechooser.el | 51 ++++++---------------------------------------------
 1 file changed, 6 insertions(+), 45 deletions(-)

diff --git a/filechooser.el b/filechooser.el
index 4759057eec..feb62152a2 100644
--- a/filechooser.el
+++ b/filechooser.el
@@ -45,7 +45,6 @@
 (defvar filechooser-mininuffer-map
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "C-f") #'filechooser-toggle-filter)
-    (define-key map (kbd "C-l") #'filechooser-insert-crm-separator)
     (define-key map [remap abort-recursive-edit] #'filechooser-abort)
     map))
 
@@ -110,11 +109,6 @@ It should have the same calling convention as
 `filechooser-save-files' which see for expected behavior."
   :type 'function)
 
-(defcustom filechooser-crm-separator ""
-  "`crm-separator' for choosing multiple files.
-It should be a literal string and can be inserted using `C-l' from minibuffer."
-  :type 'string)
-
 (defcustom filechooser-multiple-selection-key "RET"
   "The key that is used to exit minibuffer to do completion.
 I.e. the key that binds the equivalent of `exit-minibuffer' for the completion
@@ -232,18 +226,6 @@ MINIBUFFER is the value of minibuffer frame paramter."
        `(:array :signature "{sv}"))))
 
 ;;; Minibuffer based selection
-(defun filechooser-insert-crm-separator ()
-  "Insert the `filechooser-crm-separator'."
-  (interactive)
-  (insert filechooser-crm-separator))
-
-(defun filechooser--multiple-completion-table (str pred action)
-  "Completion table for reading file names.
-See Info node `(elisp) Programmed Completion' for STR, PRED and ACTION."
-  (if (eq action 'metadata)
-      '(metadata (category . file))
-    (completion-file-name-table str pred action)))
-
 (defun filechooser--multiple-group-function (completion transform)
   "Group function for `filechooser--multiple-loop-table'.
 See Info node `(elisp) Programmed Completion' for COMPLETION and TRANSFORM."
@@ -268,7 +250,7 @@ See Info node `(elisp) Programmed Completion' for STR, PRED 
and ACTION."
                  (group-function . filechooser--multiple-group-function)))
     (_ (completion-file-name-table str pred action))))
 
-(defun filechooser--read-file-name-1 (prompt &optional mustmatch filters dir 
default multiple)
+(defun filechooser--read-file-name-1 (prompt &optional mustmatch filters dir 
default)
   "Read a filename with PROMPT and predicate made from FILTERS.
 MUSTMATCH and DIR are as in `read-file-name'. DEFAULT is the default filename.
 If MULTIPLE is non-nil `completing-read-multiple' is used."
@@ -277,15 +259,9 @@ If MULTIPLE is non-nil `completing-read-multiple' is used."
         (lambda () (use-local-map (make-composed-keymap 
filechooser-mininuffer-map
                                                    (current-local-map)))
           (when dir (setq default-directory dir)))
-      (if multiple
-          (let ((crm-separator filechooser-crm-separator))
-            (completing-read-multiple
-             prompt #'filechooser--multiple-completion-table
-             (filechooser--filters-predicate filters)
-             mustmatch))
-        (read-file-name
-         prompt dir default mustmatch nil
-         (when filters (filechooser--filters-predicate filters)))))))
+      (read-file-name
+       prompt dir default mustmatch nil
+       (when filters (filechooser--filters-predicate filters))))))
 
 (defun filechooser--handle-exisiting-file (filename &optional dir filters)
   "Handle an existing FILENAME according to `filechooser-save-existing-files'.
@@ -308,7 +284,7 @@ are the filters to use in that case."
                                         (file-relative-name filename dir))))
         (_ (funcall filechooser-save-existing-files filename))))
 
-(defun filechooser--read-file-name (prompt &optional mustmatch filters dir 
default multiple)
+(defun filechooser--read-file-name (prompt &optional mustmatch filters dir 
default)
   "Read a filename with PROMPT and predicate made from FILTERS.
 MUSTMATCH and DIR are as in `read-file-name'. DEFAULT is the default filename.
 If MULTIPLE is non-nil `completing-read-multiple' is used."
@@ -323,7 +299,7 @@ If MULTIPLE is non-nil `completing-read-multiple' is used."
                     prompt mustmatch
                     (delq nil (mapcar (lambda (flt) (if (cddr flt) (cadr flt)))
                                       filechooser--filters))
-                    dir default multiple)))
+                    dir default)))
     (if (or mustmatch (not (file-exists-p result)))
         result
       (filechooser--handle-exisiting-file result dir filters))))
@@ -405,21 +381,6 @@ files which satisfy one of the active filters from FILTERS 
or
           (setq continue (eq this-command 'filechooser-multiple-continue))))
       (nreverse (mapcar #'car filechooser--multiple-selection)))))
 
-(defun filechooser-read-file-names-crm (prompt &optional dir filters)
-  "Read multiple file names using `completing-read-multiple'.
-`filechooser-crm-separator' is used as `crm-separator' and can be inserted
-using `C-l'.
-If `filechooser-use-popup-frame' is non-nil a new minibuffer only popup frame
-is used, othewise the selected frame is used.
-PROMPT is the minibuffer prompt. DIR is the directory where selection starts.
-FILTERS take the same form as elements of `filechooser-filters'. Only those
-files which satisfy one of the active filters from FILTERS or
-`filechooser-filters' are presented for completions."
-  (setq dir (file-name-as-directory
-             (expand-file-name (or dir default-directory))))
-  (filechooser--maybe-with-new-frame only
-    (filechooser--read-file-name prompt t filters dir nil 'multiple)))
-
 (defun filechooser-save-files (prompt &optional dir files)
   "Read a directory name to save FILES in it.
 If `filechooser-use-popup-frame' is non-nil a new minibuffer only popup frame



reply via email to

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