From ab89cd2d20f9bf77cccfe46ebcb28ff171e4b95e Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Wed, 25 Mar 2020 13:49:18 +0530 Subject: [PATCH] Add commentary, reorganize code --- sxiv.el | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/sxiv.el b/sxiv.el index 3883162..6fc50d8 100644 --- a/sxiv.el +++ b/sxiv.el @@ -17,7 +17,11 @@ ;; For more information, please refer to ;;; 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