Compare commits
No commits in common. "9942e063b30f199e2590c1c0ec436961be47df39" and "2909823905ed5db39eee93cb939b793a4c717285" have entirely different histories.
9942e063b3
...
2909823905
@ -27,8 +27,8 @@
|
|||||||
;; quick-find-files.el is a utlity to quickly find files in a specific
|
;; quick-find-files.el is a utlity to quickly find files in a specific
|
||||||
;; directory, with maybe a specific file extension. It can use both
|
;; directory, with maybe a specific file extension. It can use both
|
||||||
;; the shell utilities find and fd to quickly find your files and let
|
;; the shell utilities find and fd to quickly find your files and let
|
||||||
;; you select the file you’re looking for in a completing read prompt.
|
;; you select the file you’re looking for in a completing read
|
||||||
;; Refer to the README for more information.
|
;; prompt. Refer to the README for more information.
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
@ -56,8 +56,7 @@ your path. You can customize the executable to use with
|
|||||||
`quick-find-files-fd-executable' and
|
`quick-find-files-fd-executable' and
|
||||||
`quind-find-files-find-executable'."
|
`quind-find-files-find-executable'."
|
||||||
:group 'quick-find-files
|
:group 'quick-find-files
|
||||||
:type 'symbol
|
:type 'symbol)
|
||||||
:options '(fd find))
|
|
||||||
|
|
||||||
(defcustom quick-find-files-fd-executable (executable-find "fd")
|
(defcustom quick-find-files-fd-executable (executable-find "fd")
|
||||||
"Executable name or path to the executable of fd."
|
"Executable name or path to the executable of fd."
|
||||||
@ -69,7 +68,7 @@ your path. You can customize the executable to use with
|
|||||||
:group 'quick-find-files
|
:group 'quick-find-files
|
||||||
:type 'string)
|
:type 'string)
|
||||||
|
|
||||||
(defcustom quick-find-files-dirs-and-exts nil
|
(defcustom quick-find-files-dirs-and-exts '()
|
||||||
"List of pairs of directories and extensions.
|
"List of pairs of directories and extensions.
|
||||||
|
|
||||||
Each element should be a pair of a directory path and an
|
Each element should be a pair of a directory path and an
|
||||||
@ -82,8 +81,7 @@ extension, such as
|
|||||||
(defcustom quick-find-files-fd-additional-options ""
|
(defcustom quick-find-files-fd-additional-options ""
|
||||||
"Additional command-line options for fd."
|
"Additional command-line options for fd."
|
||||||
:group 'quick-find-files
|
:group 'quick-find-files
|
||||||
:type 'string
|
:type 'string)
|
||||||
:safe #'stringp)
|
|
||||||
|
|
||||||
(defcustom quick-find-files-find-additional-options ""
|
(defcustom quick-find-files-find-additional-options ""
|
||||||
"Additional command-line options for find."
|
"Additional command-line options for find."
|
||||||
@ -127,44 +125,29 @@ Return files as a list of absolute paths."
|
|||||||
|
|
||||||
; Public functions ;;;;;;;;;;;;;;;;;;;;
|
; Public functions ;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun quick-find-files-list-files (dir ext)
|
;;;###autoload
|
||||||
|
(defun quick-find-files-list-files ()
|
||||||
"List files in directories and with specific extensions.
|
"List files in directories and with specific extensions.
|
||||||
|
|
||||||
The directories and extensions are specified in the variable
|
The directories and extensions are specified in the variable
|
||||||
`quick-find-files-dirs-and-exts'.
|
`quick-find-files-dirs-and-exts'.
|
||||||
|
|
||||||
If DIR and EXT are non-nil, search only in DIR for files with the
|
|
||||||
extension EXT. Ignore `quick-find-files-dirs-and-exts'.
|
|
||||||
|
|
||||||
Return a list of paths to files."
|
Return a list of paths to files."
|
||||||
(declare (side-effect-free t))
|
(declare (side-effect-free t))
|
||||||
(if (and dir ext)
|
|
||||||
(quick-find-files--find-files dir ext)
|
|
||||||
(mapcan (lambda (dir-ext)
|
(mapcan (lambda (dir-ext)
|
||||||
(quick-find-files--find-files (car dir-ext)
|
(quick-find-files--find-files (car dir-ext)
|
||||||
(cdr dir-ext)))
|
(cdr dir-ext)))
|
||||||
quick-find-files-dirs-and-exts)))
|
quick-find-files-dirs-and-exts))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun quick-find-files(&optional arg)
|
(defmacro quick-find-files()
|
||||||
"Quickly find and open files in directories with specific extensions.
|
"Quickly find and open files in directories with specific extensions.
|
||||||
|
|
||||||
Directories in which to look for files with specific extensions
|
Directories in which to look for files with specific extensions
|
||||||
are specified in `quick-find-files-dirs-and-exts'.
|
are specified in `quick-find-files-dirs-and-exts'."
|
||||||
|
(interactive)
|
||||||
When called interactively with a prefix (i.e. non-nil ARG), ask
|
`(find-file (,quick-find-files-completing-read "Open File: "
|
||||||
user for the root directory of their search and the file
|
(quick-find-files-list-files))))
|
||||||
extention they are looking for. When the file extension is left
|
|
||||||
empty, all files are to be looked for."
|
|
||||||
(interactive "P")
|
|
||||||
(message "qff prefix: %S" arg)
|
|
||||||
(let (dir ext)
|
|
||||||
(when arg
|
|
||||||
(setq dir (read-file-name "Root directory: "))
|
|
||||||
(setq ext (read-string "File extension (leave blank for all files): ")))
|
|
||||||
(find-file (funcall quick-find-files-completing-read
|
|
||||||
"Open file: "
|
|
||||||
(quick-find-files-list-files dir ext)))))
|
|
||||||
|
|
||||||
; Provides ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
; Provides ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user