Rewrite sxiv-insert-subdirs using loop; try to fix error (issue #1)
This commit is contained in:
parent
086bc5ae97
commit
247cb7bdcb
|
@ -4,6 +4,10 @@ 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
|
||||
* Error with selected files in a subdirectory (issue #1)
|
||||
|
||||
## [0.3.2] - 2020-05-08
|
||||
### Fixed
|
||||
* Workaround for crash in certain cases
|
||||
|
|
18
sxiv.el
18
sxiv.el
|
@ -56,13 +56,17 @@ With no marked files, or if not in a Dired buffer, return nil."
|
|||
(defun sxiv-insert-subdirs (paths)
|
||||
"Insert subdirectories from PATHS into the current Dired buffer.
|
||||
Return PATHS unchanged."
|
||||
(mapc (lambda (path)
|
||||
;; is the file a direct child? (i.e. exists in the current directory?)
|
||||
(unless (and (file-exists-p (file-name-nondirectory path))
|
||||
(file-directory-p path))
|
||||
(dired-insert-subdir (file-name-directory path))))
|
||||
paths)
|
||||
paths)
|
||||
(cl-loop for path in paths
|
||||
;; If the file does not exist in the current directory...
|
||||
unless (and (file-exists-p (file-name-nondirectory path))
|
||||
;; ;; ...I don't understand why this is here!
|
||||
;; ;; Why would there be a directory in the selected
|
||||
;; ;; files, seeing as one can't mark directories in
|
||||
;; ;; sxiv?
|
||||
;; (file-directory-p path)
|
||||
)
|
||||
do (dired-insert-subdir (file-name-directory path))
|
||||
finally return paths))
|
||||
|
||||
(defun sxiv-dired-mark-files (files)
|
||||
"Mark FILES in the current (dired) buffer."
|
||||
|
|
Reference in New Issue