Add commentary, reorganize code
This commit is contained in:
parent
b8b53c104e
commit
ab89cd2d20
22
sxiv.el
22
sxiv.el
|
@ -17,7 +17,11 @@
|
||||||
;; For more information, please refer to <https://unlicense.org>
|
;; For more information, please refer to <https://unlicense.org>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; 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)
|
(require 'dash)
|
||||||
|
|
||||||
|
@ -61,6 +65,15 @@ Return PATHS unchanged."
|
||||||
paths)
|
paths)
|
||||||
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)
|
(defun sxiv-filter (_process output)
|
||||||
"Open a `dired' buffer and mark any files marked by the user in `sxiv'.
|
"Open a `dired' buffer and mark any files marked by the user in `sxiv'.
|
||||||
Used as process filter for `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-insert-subdirs it)
|
||||||
(sxiv-dired-mark-files 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)
|
(defun sxiv (&optional prefix)
|
||||||
"Run sxiv(1), the Simple X Image Viewer.
|
"Run sxiv(1), the Simple X Image Viewer.
|
||||||
By default, when run in a Dired buffer, open all files in the
|
By default, when run in a Dired buffer, open all files in the
|
||||||
|
|
Reference in New Issue