Add `sxiv-arguments` to hold argument list

This commit is contained in:
contrapunctus 2020-01-13 17:08:33 +05:30
parent 2591e0ba37
commit 85a9235f99
3 changed files with 16 additions and 2 deletions

View File

@ -5,6 +5,8 @@ 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased ## Unreleased
### Added
* `sxiv-arguments` to hold argument list
### Fixed ### Fixed
* Slow startup/freezing on large directories * Slow startup/freezing on large directories

View File

@ -16,7 +16,7 @@ With prefix argument, or when only provided directories, run recursively.
Run it from a text file containing one file name per line to open the listed files. Run it from a text file containing one file name per line to open the listed files.
## TODO ## TODO
1. Create user-customizable variable to hold default arguments 1. [x] Create user-customizable variable to hold default arguments
2. Start sxiv on the file at point (using `-n ...`) 2. Start sxiv on the file at point (using `-n ...`)
3. Let user specify paths to be excluded. 3. Let user specify paths to be excluded.
4. Mark files in subdirectories if run recursively (by inserting the subdirectory into the current buffer) 4. Mark files in subdirectories if run recursively (by inserting the subdirectory into the current buffer)

14
sxiv.el
View File

@ -12,6 +12,15 @@
;;; Code: ;;; Code:
(defgroup sxiv nil
"Run the Simple X Image Viewer."
:group 'external)
(defcustom sxiv-arguments '("-a" "-f" "-o")
"Arguments to be passed to the sxiv process.
It must contain \"-o\" for marking in Dired buffers to function."
: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.")
@ -82,7 +91,10 @@ the files listed."
(proc (make-process :name "sxiv" (proc (make-process :name "sxiv"
:buffer "sxiv" :buffer "sxiv"
:command :command
(apply #'list "sxiv" "-afo" recurse "--" paths) (append '("sxiv")
sxiv-arguments
`(,recurse "--")
paths)
:connection-type 'pipe :connection-type 'pipe
:stderr "sxiv-errors"))) :stderr "sxiv-errors")))
(setq sxiv--directory default-directory) (setq sxiv--directory default-directory)