Closed fleimgruber closed 2 years ago
(defun dirvish--get-image-cache-for-file (file size &optional ext)
(let ((cache (concat dirvish-cache-dir
(number-to-string size)
(when (memq system-type '(windows-nt ms-dos)) "/")
(replace-regexp-in-string ":" "" file))))
(unless (file-exists-p cache)
(make-directory (file-name-directory cache) t))
(concat cache ext)))
Please let me know if this works (C-x C-e
the block), I don't have a Windows machine.
Tried with your version, hitting this, let me know if I should open a new issue, but maybe it is related to this one or you want to have a single Windows compat issue - in any case happy to help testing on Windows:
Debugger entered--Lisp error: (void-function nil)
nil(#s(dirvish :name G225 :depth 1 :fullscreen-depth 1 :read-only-depth 1 :scopes (:dv #1 :tab 0 :frame #<frame lg 000001f186517c40>) :transient nil :type nil :dedicated nil :dired-buffers (#<buffer LeimgruberF</Users>> #<buffer lg> #<buffer LeimgruberF</Users>> #<buffer lg> #<buffer LeimgruberF</Users>> #<buffer lg>) :dired-windows (#<window 450 on LeimgruberF</Users>> #<window 362 on lg> #<window 443> #<window 362 on lg> #<window 436> #<window 362 on lg>) :preview-window #<window 445 on ait.ist> :preview-buffers (#<buffer ait.ist>) :window-conf #<window-configuration> :root-window-fn frame-selected-window :header-string-fn dirvish-default-header-string-fn :quit-window-fn ignore :root-window #<window 362 on lg> :root-dir-buf-alist (("c:/Users/LeimgruberF/lg/" . #<buffer lg>)) :parent-dir-buf-alist (("c:/Users/LeimgruberF/" . #<buffer LeimgruberF>)) :raw-attributes (file-size) :attributes-alist ((dirvish-hl-line-ov dirvish-attribute-hl-line-pred dirvish-attribute-hl-line-rd nil nil) (dirvish-symlink-target-ov dirvish-attribute-symlink-target-pred dirvish-attribute-symlink-target-rd nil nil) (nil nil nil nil nil)) :path "c:/Users/LeimgruberF/lg/" :index-path "c:/Users/LeimgruberF/lg/ait.ist" :raw-preview-dps (text gif image video audio epub archive pdf-tools) :preview-dispatchers (dirvish-disable-preview-dp dirvish-text-preview-dp dirvish-gif-preview-dp dirvish-image-preview-dp dirvish-video-preview-dp dirvish-audio-preview-dp dirvish-epub-preview-dp dirvish-archive-preview-dp dirvish-pdf-tools-preview-dp dirvish-default-preview-dp) :ls-switches "-alhF" :sort-criteria ("default" . "")))
dirvish--render-attributes(#s(dirvish :name G225 :depth 1 :fullscreen-depth 1 :read-only-depth 1 :scopes (:dv #1 :tab 0 :frame #<frame lg 000001f186517c40>) :transient nil :type nil :dedicated nil :dired-buffers (#<buffer LeimgruberF</Users>> #<buffer lg> #<buffer LeimgruberF</Users>> #<buffer lg> #<buffer LeimgruberF</Users>> #<buffer lg>) :dired-windows (#<window 450 on LeimgruberF</Users>> #<window 362 on lg> #<window 443> #<window 362 on lg> #<window 436> #<window 362 on lg>) :preview-window #<window 445 on ait.ist> :preview-buffers (#<buffer ait.ist>) :window-conf #<window-configuration> :root-window-fn frame-selected-window :header-string-fn dirvish-default-header-string-fn :quit-window-fn ignore :root-window #<window 362 on lg> :root-dir-buf-alist (("c:/Users/LeimgruberF/lg/" . #<buffer lg>)) :parent-dir-buf-alist (("c:/Users/LeimgruberF/" . #<buffer LeimgruberF>)) :raw-attributes (file-size) :attributes-alist ((dirvish-hl-line-ov dirvish-attribute-hl-line-pred dirvish-attribute-hl-line-rd nil nil) (dirvish-symlink-target-ov dirvish-attribute-symlink-target-pred dirvish-attribute-symlink-target-rd nil nil) (nil nil nil nil nil)) :path "c:/Users/LeimgruberF/lg/" :index-path "c:/Users/LeimgruberF/lg/ait.ist" :raw-preview-dps (text gif image video audio epub archive pdf-tools) :preview-dispatchers (dirvish-disable-preview-dp dirvish-text-preview-dp dirvish-gif-preview-dp dirvish-image-preview-dp dirvish-video-preview-dp dirvish-audio-preview-dp dirvish-epub-preview-dp dirvish-archive-preview-dp dirvish-pdf-tools-preview-dp dirvish-default-preview-dp) :ls-switches "-alhF" :sort-criteria ("default" . "")))
dirvish-update-body-h()
dirvish-revert(nil nil)
revert-buffer()
(let* ((dv (dirvish-curr)) (item (eieio-oref obj 'variable)) (slot-name (eieio-oref obj 'scope)) (curr-val (funcall slot-name dv)) (new-val (if (eq value 'On) (setq curr-val (cons item curr-val)) (delq item curr-val)))) (cond ((memql slot-name ''dv-raw-attributes) (progn (or (and (memq (type-of dv) cl-struct-dirvish-tags) t) (signal 'wrong-type-argument (list 'dirvish dv))) (let* ((v dv)) (aset v 20 new-val)))) ((memql slot-name ''dv-raw-preview-dps) (progn (or (and (memq (type-of dv) cl-struct-dirvish-tags) t) (signal 'wrong-type-argument (list 'dirvish dv))) (let* ((v dv)) (aset v 24 new-val))))) (dirvish--refresh-slots dv) (revert-buffer))
(progn (let* ((dv (dirvish-curr)) (item (eieio-oref obj 'variable)) (slot-name (eieio-oref obj 'scope)) (curr-val (funcall slot-name dv)) (new-val (if (eq value 'On) (setq curr-val (cons item curr-val)) (delq item curr-val)))) (cond ((memql slot-name ''dv-raw-attributes) (progn (or (and (memq ... cl-struct-dirvish-tags) t) (signal 'wrong-type-argument (list ... dv))) (let* ((v dv)) (aset v 20 new-val)))) ((memql slot-name ''dv-raw-preview-dps) (progn (or (and (memq ... cl-struct-dirvish-tags) t) (signal 'wrong-type-argument (list ... dv))) (let* ((v dv)) (aset v 24 new-val))))) (dirvish--refresh-slots dv) (revert-buffer)))
(closure (t) (obj value) (progn (let* ((dv (dirvish-curr)) (item (eieio-oref obj 'variable)) (slot-name (eieio-oref obj 'scope)) (curr-val (funcall slot-name dv)) (new-val (if (eq value ...) (setq curr-val ...) (delq item curr-val)))) (cond ((memql slot-name '...) (progn (or ... ...) (let* ... ...))) ((memql slot-name '...) (progn (or ... ...) (let* ... ...)))) (dirvish--refresh-slots dv) (revert-buffer))))(#<dirvish--toggle dirvish--toggle-7c657c5f20> On)
apply((closure (t) (obj value) (progn (let* ((dv (dirvish-curr)) (item (eieio-oref obj 'variable)) (slot-name (eieio-oref obj 'scope)) (curr-val (funcall slot-name dv)) (new-val (if (eq value ...) (setq curr-val ...) (delq item curr-val)))) (cond ((memql slot-name '...) (progn (or ... ...) (let* ... ...))) ((memql slot-name '...) (progn (or ... ...) (let* ... ...)))) (dirvish--refresh-slots dv) (revert-buffer)))) #<dirvish--toggle dirvish--toggle-7c657c5f20> On)
transient-infix-set(#<dirvish--toggle dirvish--toggle-7c657c5f20> On)
(let ((obj (transient-suffix-object))) (transient-infix-set obj (transient-infix-read obj)))
dirvish-file-size-infix()
funcall-interactively(dirvish-file-size-infix)
call-interactively(dirvish-file-size-infix nil nil)
command-execute(dirvish-file-size-infix)
Hi @fleimgruber , thanks for you feedback.
Tried with your version, hitting this, let me know if I should open a new issue,
I guess this (void-function nil)
error is due to a missing dependency, it seems that your dirvish-extras
library has not been loaded correctly. But if this is not the cause of the problem, I guess opening a new issue for it would be great, because it probably has nothing to do with Windows, thank you.
And relating to this image cache issue, have you tried the latest commit? Can you preview a image properly on Windows?
Thanks for taking care of this
it seems that your dirvish-extras library has not been loaded correctly
I did not even try to load that library in the first place. I missed that part in the docs as I was just trying out dirvish. Loading dirvish-extras solves that issue.
And relating to this image cache issue, have you tried the latest commit? Can you preview a image properly on Windows?
I mistitled this issue. What I tried to do was to toggle file sizes (see reproducing steps), but that hit the bug under Windows in dirvish--get-image-cache-for-file that you fixed. In any case, preview did work for me, but I will have to postpone more testing to a later time as I am experiencing issues with dirvish in general that are most probably related to my config as I am using Spacemacs with e.g. https://github.com/ralesi/ranger.el#setting-as-default-directory-handler.
So for me this issue is solved via your workaround in https://github.com/alexluigit/dirvish/issues/15#issuecomment-1066650249. I could not test with the latest commit as I did not yet find a way to include the extensions subdirectory when loading via git in Spacemacs. Please feel free to close, I will reopen in case the committed fix does not work for me when it lands in MELPA.
I mistitled this issue. What I tried to do was to toggle file sizes (see reproducing steps), but that hit the bug under Windows in dirvish--get-image-cache-for-file that you fixed.
Yes, I understood that. The reason I asked the question that way is because both image preview and dirvish-revert
(in the 1st backtrace you posted) rely on the dirvish--get-image-cache-for-file
function. So, theoretically, if dirvish-revert
doesn't work, image preview won't work correctly either. My bad, should've explained it more clearly.
My bad, should've explained it more clearly.
Never mind, I could have put the pieces together myself, but was focused on another concurrent task. Thanks for explaining and responding so quickly.
Windows 10, Emacs 27.2.50, dirvish-20220313.911
Steps to reproduce:
Backtrace: