Add commentary, reorganize code

This commit is contained in:
contrapunctus 2020-03-25 13:49:18 +05:30
parent b8b53c104e
commit ab89cd2d20
1 changed files with 13 additions and 9 deletions

22
sxiv.el
View File

@ -17,7 +17,11 @@
;; For more information, please refer to <https://unlicense.org>
;;; Commentary:
;; The sole command and primary entry point is `sxiv'.
;;
;; `sxiv-filter' is the process filter, to insert subdirectories (via
;; `sxiv-insert-subdirs') and mark files marked in sxiv (via
;; `sxiv-dired-mark-files').
(require 'dash)
@ -61,6 +65,15 @@ Return PATHS unchanged."
paths)
paths)
(defun sxiv-dired-mark-files (files)
"Mark FILES in the current (dired) buffer."
(dired-mark-if
(and (not (looking-at-p dired-re-dot))
(not (eolp))
(let ((fn (dired-get-filename t t)))
(and fn (--find (equal fn it) files))))
"file"))
(defun sxiv-filter (_process output)
"Open a `dired' buffer and mark any files marked by the user in `sxiv'.
Used as process filter for `sxiv'.
@ -72,15 +85,6 @@ OUTPUT is the output of the sxiv process as a string."
(sxiv-insert-subdirs it)
(sxiv-dired-mark-files it)))
(defun sxiv-dired-mark-files (files)
"Mark FILES in the current (dired) buffer."
(dired-mark-if
(and (not (looking-at-p dired-re-dot))
(not (eolp))
(let ((fn (dired-get-filename t t)))
(and fn (--find (equal fn it) files))))
"file"))
(defun sxiv (&optional prefix)
"Run sxiv(1), the Simple X Image Viewer.
By default, when run in a Dired buffer, open all files in the