Remove unnecessary conversion from list of strings to string

This has made the code a lot more performant with large directories.

After the above removal, the (mapcar #'shell-quote-argument) was
removed because it was causing issues with recursive operation - many
directories ended up being left out, and sxiv complained about not
being able to find them.
This commit is contained in:
contrapunctus 2020-01-13 16:47:59 +05:30
parent d67f6721d7
commit 2591e0ba37
3 changed files with 8 additions and 12 deletions

View File

@ -4,4 +4,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
* Slow startup/freezing on large directories
## [0.1.0] - 2020-01-12

View File

@ -25,7 +25,6 @@ Run it from a text file containing one file name per line to open the listed fil
7. What should be the behavior when we open Dired-marked files, then mark files within sxiv?
## Limitations
* Currently falls flat if run in directories with a huge number of images.
* `sxiv-dired-marked-files-p` doesn't work as intended with non '*' markers (e.g. C or D)
## Comparison with [picpocket](https://github.com/johanclaesson/picpocket)

15
sxiv.el
View File

@ -75,21 +75,14 @@ the files listed."
(recurse (or prefix
(-every? #'file-directory-p paths)))
;; remove directories if not running recursively
(paths (->> (if recurse
paths
(seq-remove #'file-directory-p paths))
(mapcar #'shell-quote-argument)
(--reduce (concat acc " " it))))
(paths (if recurse
paths
(seq-remove #'file-directory-p paths)))
(recurse (if recurse "-r" ""))
(proc (make-process :name "sxiv"
:buffer "sxiv"
:command
(list shell-file-name
shell-command-switch
(concat "sxiv -afo "
recurse
" -- "
paths))
(apply #'list "sxiv" "-afo" recurse "--" paths)
:connection-type 'pipe
:stderr "sxiv-errors")))
(setq sxiv--directory default-directory)