I don't use dired
mode too often, but was trying to practice with it a bit. So I created a few empty practice text files and marked them with the usual dired shortcut key. Then I tried to rename the files using the "R" command--in order to move the files to a new folder. I get this odd error and the operation does not succeed.
apply: Wrong number of arguments: (8 . 8), 10 [3 times]
I ran into the same error when I tried to do a copy using the "C" command. But interestingly enough, the problem does not occur when I tried to do a delete with "D". Delete did work. So it seems like somewhere the apply
function is being used incorrectly.
I am using emacs version 25.3 and Spacemacs version 0.200.13.x on ubuntu linux 16.04 LTS.
Does anyone have a sense of why this error is occurring? Since dired
is part of the emacs core, I imagine there might be some conflict with a different package or something. I checked the spacemacs github repo issues list, but did not see any problems mentioned. Any help would be appreciated.
UPDATED
As per Phil's suggestion, here is the stacktrace:
Debugger entered--Lisp error: (wrong-number-of-arguments (8 . 8) 10)
helm-read-file-name-handler-1("Rename jarrett-iccv-09.pdf to: " read-file-name-internal file-exists-p nil "~/Downloads/" file-name-history nil nil "dired-do-rename" "*helm-mode-dired-do-rename*")
apply(helm-read-file-name-handler-1 ("Rename jarrett-iccv-09.pdf to: " read-file-name-internal file-exists-p nil "~/Downloads/" file-name-history nil nil "dired-do-rename" "*helm-mode-dired-do-rename*"))
helm--completing-read-default("Rename jarrett-iccv-09.pdf to: " read-file-name-internal file-exists-p nil "~/Downloads/" file-name-history nil nil)
apply(helm--completing-read-default ("Rename jarrett-iccv-09.pdf to: " read-file-name-internal file-exists-p nil "~/Downloads/" file-name-history nil nil))
#f(advice-wrapper :override completing-read-default helm--completing-read-default)("Rename jarrett-iccv-09.pdf to: " read-file-name-internal file-exists-p nil "~/Downloads/" file-name-history nil nil)
completing-read("Rename jarrett-iccv-09.pdf to: " read-file-name-internal file-exists-p nil "~/Downloads/" file-name-history nil)
read-file-name-default("Rename jarrett-iccv-09.pdf to: " "/home/krishnab/Downloads/" nil nil nil nil)
read-file-name("Rename jarrett-iccv-09.pdf to: " "/home/krishnab/Downloads/" nil nil nil nil)
ido-read-file-name("Rename jarrett-iccv-09.pdf to: " "/home/krishnab/Downloads/" nil nil nil nil)
apply(ido-read-file-name ("Rename jarrett-iccv-09.pdf to: " "/home/krishnab/Downloads/" nil nil nil nil))
#f(advice-wrapper :override #f(advice-wrapper :override read-file-name-default helm--generic-read-file-name) ido-read-file-name)("Rename jarrett-iccv-09.pdf to: " "/home/krishnab/Downloads/" nil nil nil nil)
read-file-name("Rename jarrett-iccv-09.pdf to: " "/home/krishnab/Downloads/" nil)
apply(read-file-name ("Rename jarrett-iccv-09.pdf to: " "/home/krishnab/Downloads/" nil))
dired-mark-pop-up(nil move ("jarrett-iccv-09.pdf") read-file-name "Rename jarrett-iccv-09.pdf to: " "/home/krishnab/Downloads/" nil)
dired-mark-read-file-name("Rename %s to: " "/home/krishnab/Downloads/" move nil ("jarrett-iccv-09.pdf") nil)
dired-do-create-files(move dired-rename-file "Move" nil t "Rename")
dired-do-rename(nil)
funcall-interactively(dired-do-rename nil)
call-interactively(dired-do-rename nil nil)
command-execute(dired-do-rename)
UPDATED 2
There does seem to be a similar issue reported under the helm
github repository. Seems that helm and ido mode are not compatible.
https://github.com/emacs-helm/helm/issues/1819
There is also a reference to this in the helm
wiki.
https://github.com/emacs-helm/helm/wiki#use-helm-mode-and-ido-mode
I tried some of their suggestions, like adding
'(helm-completing-read-handlers-alist
(quote
((find-file-read-only . ido)
(find-alternate-file . nil))
But still getting the same error.
At first glance, this looks to me like a bug in the current version of helm.
Installing helm from MELPA, I see that helm-read-file-name-handler-1
accepts 8 arguments:
(helm-read-file-name-handler-1 PROMPT DIR DEFAULT-FILENAME MUSTMATCH INITIAL PREDICATE NAME BUFFER)
While helm--completing-read-default
is guaranteed to call it with 10, as per the stack trace.
helm--completing-read-default
looks up dired-do-rename
in helm-completing-read-handlers-alist
and finds that it is mapped to helm-read-file-name-handler-1
. It then recognises the handler as being name-spaced as a helm function and, on that basis, calls it with 2 additional helm-specific arguments.
By default, helm-completing-read-handlers-alist
includes:
(dired-do-rename . helm-read-file-name-handler-1)
(dired-do-copy . helm-read-file-name-handler-1)
(dired-do-symlink . helm-read-file-name-handler-1)
(dired-do-relsymlink . helm-read-file-name-handler-1)
(dired-do-hardlink . helm-read-file-name-handler-1))
So this issue affects all of those dired commands.
You could presuambly work around this by removing all of those.
e.g. M-x customize-option
RET helm-completing-read-handlers-alist