dirvish icon indicating copy to clipboard operation
dirvish copied to clipboard

[Feature Request] dirvish-dired-noselect-a supports list as first argument

Open dvzubarev opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. I was trying to use embark-export with results of consult-find command. It resulted in an error:

Debugger entered--Lisp error: (wrong-type-argument stringp ("/home/denin/.emacs.d/.local/straight/repos/dirvish..." "EXTENSIONS.org"))
  dirvish-dired-noselect-a(#f(compiled-function (dir-or-list &optional switches) "Like `dired' but return the Dired buffer as value, do not select it." #<bytecode 0x15e7e8ce443ced1a>) ("/home/denin/.emacs.d/.local/straight/repos/dirvish..." "EXTENSIONS.org"))
  apply(dirvish-dired-noselect-a #f(compiled-function (dir-or-list &optional switches) "Like `dired' but return the Dired buffer as value, do not select it." #<bytecode 0x15e7e8ce443ced1a>) ("/home/denin/.emacs.d/.local/straight/repos/dirvish..." "EXTENSIONS.org"))
  dired-noselect(("/home/denin/.emacs.d/.local/straight/repos/dirvish..." "EXTENSIONS.org"))
  embark-export-dired(("~/.emacs.d/.local/straight/repos/dirvish/docs/EXTE..."))
  embark-export()

Describe the solution you'd like In the documentation for dired-noselect the first argument is named DIR-OR-LIST. And in the documentation of dired is stated that the first argument may be a list:

If DIRNAME is a cons, its first element is taken as the directory name
and the rest as an explicit list of files to make directory entries for.

It would be good if dirvish supports dired API, so it can work with thirdparty packages

Describe alternatives you've considered

Additional context

dvzubarev avatar Jan 28 '23 14:01 dvzubarev

Yes, I'd rather consider this a bug, since it breaks the expected functionality of in-build and other packages.

andersjohansson avatar Feb 10 '23 11:02 andersjohansson

Until there's a better solution, here's a dirty hack to keep using embark-export with dirvish:

(advice-add 'dirvish-dired-noselect-a
            :before-until
            (defun my/dirvish-dired-noselect-on-lists (&rest args)
              (and (listp (cadr args))
                  (apply (car args) (cdr args)))))

Dirty since we're advising an advice function to unadvise the original function (dired-noselect) under certain conditions. :)

karthink avatar Feb 25 '23 09:02 karthink