Add support for excluding files
This commit is contained in:
parent
85a9235f99
commit
76f63afd54
9
sxiv.el
9
sxiv.el
|
@ -21,6 +21,10 @@
|
||||||
It must contain \"-o\" for marking in Dired buffers to function."
|
It must contain \"-o\" for marking in Dired buffers to function."
|
||||||
:type '(repeat string))
|
:type '(repeat string))
|
||||||
|
|
||||||
|
(defcustom sxiv-exclude-strings '()
|
||||||
|
"Exclude files whose paths match these strings."
|
||||||
|
:type '(repeat string))
|
||||||
|
|
||||||
(defvar sxiv--directory nil
|
(defvar sxiv--directory nil
|
||||||
"Directory `sxiv' was called from.
|
"Directory `sxiv' was called from.
|
||||||
Used by `sxiv-filter' to know where to mark files.")
|
Used by `sxiv-filter' to know where to mark files.")
|
||||||
|
@ -78,7 +82,10 @@ the files listed."
|
||||||
(split-string it "\n")))
|
(split-string it "\n")))
|
||||||
(t (directory-files default-directory))))
|
(t (directory-files default-directory))))
|
||||||
(paths (--remove (or (equal it ".")
|
(paths (--remove (or (equal it ".")
|
||||||
(equal it ".."))
|
(equal it "..")
|
||||||
|
(-find (lambda (exclude)
|
||||||
|
(string-match-p exclude it))
|
||||||
|
sxiv-exclude-strings))
|
||||||
paths))
|
paths))
|
||||||
;; recurse with prefix arg, or if every path is a directory
|
;; recurse with prefix arg, or if every path is a directory
|
||||||
(recurse (or prefix
|
(recurse (or prefix
|
||||||
|
|
Reference in New Issue