-
-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
discrepancy between helm-read-file-name-handler-1
with 8 arguments versus helm--completing-read-default
with 10 arguments
#2085
Comments
I worked with a saavy elisp person through StackExchange to do some root cause analysis. Here is an excerpt from the answer. [EXCERPT] Installing helm from MELPA, I see that helm-read-file-name-handler-1 accepts 8 arguments:
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) 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 |
Noting also that a conflict between Without To reproduce the error you can use It seems like each handler registered in |
phil-s <notifications@github.com> writes:
Noting also that a conflict between `helm` and `ido` was the trigger for this error.
Without `ido` being active, helm uses `helm--generic-read-file-name`
when these dired commands are used (rather than
`helm--completing-read-default`), and the former function is only
adding the 2 extra helm-specific arguments to an initial set of 6
giving the correct total of 8, which is obviously how it's intended to
work.
To reproduce the error you can use `M-x ido-everywhere`,
See https://github.com/emacs-helm/helm/wiki/FAQ#helm-mode-conflict-with-ido-everywhere
See also bug #1441.
This is a duplicate of bug #1527.
…--
Thierry
|
If a change was to be made (and I'm not expecting one), my first impression is that perhaps e.g. Does that sounds like a sane approach? I don't know much about helm, so I'm just speculating. |
No, there is no problems with |
Note also that by removing the dired commands from So to summarize there is no bug if you don't use ido-everywhere and helm-mode at the same time, |
Note that a simple assertion at beginning of generic helm functions would be enough: (cl-assert (null ido-everywhere)
nil "ido-everywhere is incompatible with helm, please disable it") |
Thanks Thierry. I was just about to suggest something similar... Despite the non-standard name, |
I wondered whether the name indicated that originally |
phil-s <notifications@github.com> writes:
Thanks Thierry. I was just about to suggest something similar...
Thanks.
Despite the non-standard name, ido-everywhere turns out to be a global
minor mode defined with the standard macro; so we can test the
ido-everywhere variable, react in ido-everywhere-hook, and disable it
by passing an argument (ido-everywhere -1). Between all that, helm
probably has the tools to prevent this conflict from happening.
Of course we can disable ourselves ido-everywhere in each helm generic
functions, but I think this doesn't help the user, I think returning a
good old error saying there is a conflict is more educative.
Also the offending call of completing-read is IIUC in ido-read-internal
because when ido-everywhere is enabled it advices only read-file-name and
read-buffer so the completing-read-function is still a helm function, so
when helm is called here, there is already a conflict.
…--
Thierry
|
Helm itself is enabled or disabled by My thinking was that enabling
Or can "each helm generic function" be used even when In any case, "returning a good old error saying there is a conflict" sounds entirely reasonable and, as you point out, is more informative, even if it's (initially) a bit more disruptive. |
phil-s <notifications@github.com> writes:
Helm itself is enabled or disabled by helm-mode, no?
Not necessarily, all the helm native functions like helm-find-files,
helm-M-x etc... can be used without enabling helm-mode.
(Apologies if I've misunderstood -- I don't actually use Helm or Ido,
so I'm making some assumptions, but IIRC when I played with Helm I
invoked helm-mode to get started...)
My thinking was that enabling helm-mode could potentially:
* Disable ido-everywhere, if it was already enabled.
* Register an ido-everywhere-hook function which would disable
ido-everywhere should anything attempt to enable it.
Yes that would work, but then we will have users complaining they have
enabled ido and it is not working because helm is disabling it, and we
will have to reexplain that ido is incompatible with helm, this is also
why I would prefer raising directly an error.
Or can "each helm generic function" be used even when helm-mode is disabled?
No, they are never called when helm-mode is disabled, the
incompatibility between helm and ido is only when helm-mode is enabled
(and ido-everywhere also of course), but one can use a helm command
e.g. helm-find-files or helm-M-x with ido-everywhere enabled without any
error.
In any case, "returning a good old error saying there is a conflict"
sounds entirely reasonable and, as you point out, is more informative,
even if it's a bit more disruptive.
Yes.
Thanks to look into this.
…--
Thierry
|
Okay, so basically I needed to add the instruction:
to the |
@00krishna, I suggest that you |
@00krishna I suggest also you separate the custom settings in another file to keep your init file clean i.e. only the settings you add yourself manually, for this use: (setq custom-file "~/.emacs.d/.emacs-custom.el")
(load custom-file) @phil-s Helm have much better tools to search files and buffers than rgrep ;-) |
* helm-mode.el (helm-mode--disable-ido-maybe): New. (helm-mode--ido-everywhere-hook): New. (helm-mode): Disable ido-everywhere when it is enabled and prevent enabling it when helm-mode is already running. (helm--generic-read-file-name): With the new behavior of helm-mode with ido, ido-mode is unable to run when helm-mode is enabled, fix it.
Finally found the time to work on this. |
Why is this recently causing such a problem. Before that we were able to use both helm and ido alongside and I liked that behaviour since I use both. Now it's either one or the other. Also in my case this has affected the kill-buffer ability in a sense where I cannot properly kill all buffers if I want to. The last properly working version of helm is 20181124.1444. Why was it necessary to change the last properly working bahaviour, dunno understand. |
kirk86 <notifications@github.com> writes:
Why is this recently causing such a problem. Before that we were able
to use both helm and ido alongside and I liked that behaviour since I
use both.
No if you used ido-mode with helm-mode together, it worked by chance,
because one or the other was loaded before, you can easily understand
that if you enable ido-mode for handling C-x b for example and also
helm-mode you have concurrency between the both, probably the last
enabled will predate the former.
Now it's either one or the other. Dunno understand.
Yes and it is the sane way to go to avoid bugs such as this one.
Hopefully helm provide helm-completing-read-handlers-alist to enable Ido
in commands of your choice if needed whereas Ido provide nothing to
handle such situations.
…--
Thierry
|
@thierryvolpiatto I don't understand this. Please forgive my ignorance but how do you verify that there's concurrency between the both in the first place? In my case I have both modes enabled using helm version indicated in my previous post and I do not observe such a concurrency issue that your are referring to. As a matter in fact if I update to the latest helm I observe strange behaviour in my emacs, meaning some keybindings come disabled after upgrade and restart of emacs and furthermore the kill-buffer function is not working properly meaning is not possible to kill all buffers and hangs while killing buffers then it shows the kill ring buffer and when you try to kill that as well you end up in the same place, just like a cycle loop.
Again forgive my ignorance but what is so catastrophic about this bug, how do we verify that is indeed a bug and why are we observing this supposedly bug only now, and I'm only saying this cause in my 2 years experience of using both never had such an issue before, both modes enabled.
|
* helm-mode.el (helm-mode--disable-ido-maybe): Do it.
kirk86 <notifications@github.com> writes:
@thierryvolpiatto I don't understand this. Please forgive my ignorance
but how do you verify that there's concurrency between the both in the
first place? In my case I have both modes enabled using helm version
indicated in my previous post and I do not observe such a concurrency
issue that your are referring to.
Ok, so I have reenabled ido-mode, disabling only ido-everywhere, sad to
see people use such configuration i.e. ido-mode+helm-mode which is non-sense.
As a matter in fact if I update to the latest helm I observe strange
behaviour in my emacs, meaning some keybindings come disabled after
upgrade and restart of emacs and furthermore the kill-buffer function
is not working properly meaning is not possible to kill all buffers
and hangs while killing buffers then it shows the kill ring buffer and
when you try to kill that as well you end up in the same place, just
like a cycle loop.
I can't reproduce this, please provide a recipe starting from
emacs-helm.sh in another bugreport.
Thanks.
…--
Thierry
|
@thierryvolpiatto thanks for the reply! Even when enabling ido-everywhere I don't experience any difficulties. If you want for instance you can use clean emacs installation without any config and on top of that install prelude. You will see that prelude has this configuration where ido-mode and helm-mode come enabled by default but not ido-everywhere, even though enabling ido-everywhere I didn't experience any issues. Could it be possible that concurrency you mentioned be os specific. Haven't seen any issues on *nix systems, dunno about windows.
|
kirk86 <notifications@github.com> writes:
Even when enabling ido-everywhere I don't experience any
difficulties. If you want for instance you can use clean emacs
installation without any config and on top of that install
prelude. You will see that prelude has this configuration where
ido-mode and helm-mode come enabled by default but not ido-everywhere,
even though enabling ido-everywhere I didn't experience any issues.
So prelude should stop doing this and use
helm-completing-read-handlers-alist where needed.
You don't have issue stricly speaking with ido-mode+helm-mode or
helm-mode+ido-mode but you don't have control on what does exactly
ido-mode and/or helm-mode, if you enable helm-mode only, helm provide a
way to configure exactly what does helm and what does ido.
OTOH ido-everywhere creates conflict with helm-mode because it enable
an advice on completing-read-function so depending on the order where
you enabled ido-everywhere you hit bug #2085, it is easy to understand
reading code of ido-everywhere, ido-mode and helm-mode.
Could it be possible that concurrency you mentioned be os
specific. Haven't seen any issues on *nix systems, dunno about
windows.
No, it is not OS specific the issue is on all systems.
…--
Thierry
|
Expected behavior
I use
helm
with Spacemacs, but I think I found a helm issue. I also appreciate that the lead developer is just doing bug fixes now, so I don't necessarily expect a resolution to this issue. But I figured I would certainly document the problem in case anyone else has a similar issue.When using dired mode in spacemacs 0.200.13.x on emacs 26.1 I have inconsistent
behavior with the Rename and Copy operations. I can mark a couple of files
and then click R for rename. The first time this will usually work and I get
the prompt for the directory in which to move the files. The second time I try
and do this, I get an error message
apply: Wrong number of arguments: (8 . 8), 10
There does not seem to be anything else wrong, but it makes dired unusable.
NOTE:
I did try running emacs -Q and then executing the same sequence of commands in the Reproduction section. With the vanilla config, the commands work just fine. So something in the Spacemacs config is causing this though it is not clear whether that is a conflict with an existing package or something else.
Actual behavior (from
emacs-helm.sh
if possible, see note at the bottom)I just observe the error message apply: Wrong number of arguments: (8 . 8), 10.
The files are not renamed or moved.
Steps to reproduce (recipe)
Backtraces if any (
M-x toggle-debug-on-error
)Describe versions of Helm, Emacs, operating system, etc.
Emacs 26.1, Spacemacs 0.200.13.x on Ubuntu Linux 16.04x64 LTS.
Are you using
emacs-helm.sh
to reproduce this bug (yes/no):No. Note from the additional information below, we already traced the issue in helm. So did not
need to do additional analysis through emacs-helm.sh.
IMPORTANT NOTE
Helm provides a script named
emacs-helm.sh
which runs Helm in a neutralenvironment: no other packages and only minimal settings.
When possible, use it to reproduce your Helm issue to ensure no other package is
interfering.
To run it, simply switch to the directory where Helm is installed and call
./emacs-helm.sh
.If necessary you can specify emacs executable path on command line with "-P" option.
Thanks.
The text was updated successfully, but these errors were encountered: