`+mu4e/attach-files` raises error when used with `dirvish`
- Dominant language
- Emacs Lisp
- Stars
- 22.7k
- Forks
- 3.1k
- Avg merge
- 10h 46m
- Merged PRs (30d)
- 4
Description
### I confirm that...
- [X] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.
- [X] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.
- [X] The issue can be reproduced on the **latest** available commit of Doom.
- [X] The issue can be reproduced on a stable release of Emacs, such as 27 or 28. *(Doom does not support development builds like 29+ or any version ending in .50 or .9x)*
### Expected behavior
With the `(dired +dirvish)` module enabled, when composing an `mu4e` message, when one calls `+mu4e/attach-files` and selects a directory, a `dired` buffer should be opened without errors.
### Current behavior
The call fails with the following error:
```
Debugger entered--Lisp error: (wrong-type-argument stringp #s(dirvish :path "~/Downloads/" :layout nil :last-fs-layout (1 0.11 0.55) :no-parents nil :attributes (all-the-icons git-msg) :attribute-fns ((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) (dirvish-all-the-icons-ov dirvish-attribute-all-the-icons-pred dirvish-attribute-all-the-icons-rd (+ (length dirvish-icon-delimiter) 2) nil) (dirvish-git-msg-ov dirvish-attribute-git-msg-pred dirvish-attribute-git-msg-rd nil nil)) :preview-dispatchers (text gif image video audio epub archive pdf-tools) :preview-fns (dirvish-remote-preview-dp 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 nil :header-line-format ((:eval (let* ((dv (dirvish-curr)) (fullscreenp (dv-layout dv)) (buf (alist-get ... ... nil nil ...)) (height (if fullscreenp 1.1 1.0)) (win-width (floor ...)) (raise (if fullscreenp 0 0)) (str-left (propertize ... ... ...)) (str-right (propertize ... ... ...)) (str-right-length (length str-right)) (str-length (+ ... str-right-length)) (filling-spaces (propertize " " ... ...))) (concat (format-mode-line '...) (if (< str-length win-width) str-left (let ... ...)) filling-spaces str-right)))) :mode-line-format ((:eval (let* ((dv (dirvish-curr)) (fullscreenp (dv-layout dv)) (buf (alist-get ... ... nil nil ...)) (height 1) (win-width (floor ...)) (raise 0) (str-left (propertize ... ... ...)) (str-right (propertize ... ... ...)) (str-right-length (length str-right)) (str-length (+ ... str-right-length)) (filling-spaces (propertize " " ... ...))) (concat nil (if (< str-length win-width) str-left (let ... ...)) filling-spaces str-right)))) :root-window-fn # :root-window # :find-file-window-fn selected-window :quit-window-fn ignore :scopes (:dv #3 :tab 0 :frame # :mini nil) :dired-buffers (#) :preview-buffers nil :preview-window nil :name G657 :window-conf # :root-dir-buf-alist (("/home/ev/Downloads/" . #)) :parent-dir-buf-alist nil :index-dir "/home/ev/Downloads/"))
set-buffer(#s(dirvish :path "~/Downloads/" :layout nil :last-fs-layout (1 0.11 0.55) :no-parents nil :attributes (all-the-icons git-msg) :attribute-fns ((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) (dirvish-all-the-icons-ov dirvish-attribute-all-the-icons-pred dirvish-attribute-all-the-icons-rd (+ (length dirvish-icon-delimiter) 2) nil) (dirvish-git-msg-ov dirvish-attribute-git-msg-pred dirvish-attribute-git-msg-rd nil nil)) :preview-dispatchers (text gif image video audio epub archive pdf-tools) :preview-fns (dirvish-remote-preview-dp 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 nil :header-line-format ((:eval (let* ((dv (dirvish-curr)) (fullscreenp (dv-layout dv)) (buf (alist-get ... ... nil nil ...)) (height (if fullscreenp 1.1 1.0)) (win-width (floor ...)) (raise (if fullscreenp 0 0)) (str-left (propertize ... ... ...)) (str-right (propertize ... ... ...)) (str-right-length (length str-right)) (str-length (+ ... str-right-length)) (filling-spaces (propertize " " ... ...))) (concat (format-mode-line '...) (if (< str-length win-width) str-left (let ... ...)) filling-spaces str-right)))) :mode-line-format ((:eval (let* ((dv (dirvish-curr)) (fullscreenp (dv-layout dv)) (buf (alist-get ... ... nil nil ...)) (height 1) (win-width (floor ...)) (raise 0) (str-left (propertize ... ... ...)) (str-right (propertize ... ... ...)) (str-right-length (length str-right)) (str-length (+ ... str-right-length)) (filling-spaces (propertize " " ... ...))) (concat nil (if (< str-length win-width) str-left (let ... ...)) filling-spaces str-right)))) :root-window-fn # :root-window # :find-file-window-fn selected-window :quit-window-fn ignore :scopes (:dv #1 :tab 0 :frame # :mini nil) :dired-buffers (#) :preview-buffers nil :preview-window nil :name G657 :window-conf # :root-dir-buf-alist (("/home/ev/Downloads/" . #)) :parent-dir-buf-alist nil :index-dir "/home/ev/Downloads/"))
```
This is because in `(with-current-buffer (dired location) ...)`, `dired` is expected to return a buffer. However, when the `+dirvish` flag is present, `dired` is advised with `dirvish-dired-ad`, whose last form is `(dirvish-new t :path dirname :ls-switches switches)`, which does not return a buffer.
### Steps to reproduce
1. With mu4e installed, press `SPC o m`.
2. Press `C` to compose a new email.
3. Press `SPC m a` to add an attachment.
4. Select a directory.
### System Information
https://pastebin.com/JtQjmMXQ
Contributor guide
Assessment
This issue has not been assessed yet.