-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
term-char-mode no longer usable as a terminal emulator #4063
Comments
I apologize if you find my fix a kludge.
Almost all terminals do not support the Meta/Alt key in the first place. Now, as far as using
I do agree that this would be nice, but how would you make this integrate cleanly with Spacemacs? I do not want to have to use an inconsistent The point of running terms in Emacs is to integrate it with everything else in Emacs. If you need special unergonomic escape sequences in terms, it defeats the purpose. |
Okay, that was too harsh. I said it was a kludge because I think that restoring the documented
I will have to read your link before making further criticism. |
If the goal of |
The problem is that either:
|
@StreakyCobra I guess we just make the override behavior optional since we clearly can't please everyone. The only question then is what's the right default. |
By the way the only reason helm was getting functionality overridden is because of the conflicting choice of leader key in #4047 |
@justbur Is there an easy way to disable this override per-mode basis? |
Why are I'm not so sure about #4047; please disregard my comment. I'm not seeing the problems with |
I guess I could add the option... Or we could manually bind in the modes.
|
If the default is to not enable it everywhere, then it's better to manually add it in each mode. |
Come to think of it I think the change in #4047 probably has to do with the minibuffer bindings which I don't think evil leader had any effect on. |
I can setup the override behavior as a proper minor mode, so that it can easily be disabled through hooks. This seems like a good solution to me, but I'll wait for @syl20bnr before I start making changes to bind-map again. |
I like this way, FWIW :-) |
Actually, I would like this term issue clarified further. Default EmacsBy default, Emacs has term-line-mode and term-char-mode. term-char-mode works rather intuitively: hit a key and term-mode sends it to the running application. There's one escape key, which is used to access Emacs. term-line-mode is different. Almost all of Emacs's commands are retained, including text editing commands. The only different is that when you hit Enter, the current line of text is sent to the running application all at once. Of course, you can switch freely between the two modes. term-line-mode's benefits (vs term-char-mode):
Disadvantages:
Short example using bashLet's say I type In term-char-mode, I type In term-line-mode, I type Spacemacs nowCurrently, Spacemacs uses a bastardized version of term-char-mode which has been somewhat evilified. In particular:
What to doI think it would be nice to bring Spacemacs more in line with default Emacs behavior and generally clean up all of the term modes ( Have a term-line-mode which works like the default term-line-mode, except evilified as needed. Have a term-char-mode which strictly uses only one escape key, probably I don't know which one should be the default. I think it should be term-line-mode, which maintains consistency with the rest of Spacemacs, whereas term-char-mode behaves as expected for users expecting a plain terminal editor without any of the advantages provided by running a term in Emacs. |
I will throw numbered questions in all directions with no mention. Question 1: Is the issue mentioned here related to #4054 or is it related to
Yes.
Yes. Question 2: What's the binding to switch to term-char-mode ?
Question 3: Could it be a new keyword ?
I like this solution, very easy and intuitive to disable it per mode. |
BTW: I'm not a heavy user of terminals inside Emacs, I use eshell most of the time for simple commands like tests etc... I learned in this thread about the two different editing modes of Emacs in terminals so bear with me on this one, I'll do my best to understand the issue. :-) |
No. The problem @kalbr (the issue creator) is running into can be solved at different levels. It can be immediately fixed by fixing override behavior, so...
Yes. At a lower level though, the complaint @kalbr raises is that Spacemacs messed up term-char-mode's semantics by evilifying it. This cannot be fixed by fixing override mode.
Emacs's default bindings are Off-topic: Can someone with the requisite knowledge write documentation for how Spacemacs's keymaps are handled? With global maps, evil maps, per mode maps, autoloading, hooks, and other things setting keys willy-nilly, it's hard to keep key bindings sane and I think is the hidden cause of recent keybinding issues such as this and #4047. |
@kalbr please update bind-map from MELPA and add the following hook to your user-config to test (add-hook 'term-mode-hook (lambda () (spacemacs-default-map-override-mode -1))) If it works, this should probably be added to the spacemacs config, but it would be helpful for you to test first. |
@darkfeline I can comment on how key bindings work, but I'm not sure there is a "policy" for handling key bindings. We're in the midst of changing the way that they are handled (removing evil-leader mainly) and there are some hiccups here and there. Getting the priority of keys right for everyone is nearly impossible, so the fact that there were some subtle changes to priority recently has introduced some issues. On the matter of #4047, the poster of that issue specifically chose a leader key with conflicting keys, |
Also, this should put your term-mode buffers in emacs state (push 'term-mode evil-emacs-state-modes) It's also incorrect to say that term-modes have been "evilified", at least not in the sense that it's meant in spacemacs |
I'm suggesting documenting the priority of key binds so that
doesn't happen. Something like defining clear priorities:
and the proper commands and files for defining bindings at each level.
I know, perhaps I should have said "made evil-friendly". |
@justbur I've tried your suggestion w.r.t. My test is that As far as I can tell my install is up to date. (I used the 'update packages' link on the spacemacs home buffer, and am also up to date with |
@kalbr I'm not sure why For |
System Info
(emacs-lisp latex org shell spell-checking themes-megapack git) |
@kalbr I think I have an answer on (define-key term-raw-map "\C-x" 'term-send-raw) You should be able to exclude that package entirely if you don't want that behavior, but @StreakyCobra was testing that method and it wasn't working exactly right yet. That leaves the |
@darkfeline here's a stab at what you are asking for. Someone please feel free to turn this into a PR The priority of Emacs keymaps is
Using the default leader keys for example, It's important to note that when the same key is bound at exactly the same level (from emacs perspective level 2 is the same level. Evil creates its own internal hierarchy), emacs uses the first binding it finds. There are some subtleties not covered, but I think that covers the basics. By the way, before evil-leader had everything at 2(ii). |
At first it looks like Evil hierarchy is a mess. @justbur what's your opinion on this ? |
@syl20bnr My opinion on what? Evil's hierarchy or how we use it? |
@justbur Do you think that all the levels are required ? Is it possible to simplify the hierarchy ? |
@justbur Do you know an example for each level ? |
Yes, I do actually. I don't understand how we would simplify it, since this is the framework set up by evil and emacs together. |
I'm looking for a way to simplify it at the user level, this is overly complicated to my taste, especially with no example associated to them. But maybe with examples it will be OK, still, |
@justbur If I rephrase my question: what are the levels impacted by bind-map ? What are the levels that make sense for spacemacs users ? Are there levels that are implementation details ? |
With examples
Updated with more examples |
☝️ this is priceless, thank you! |
@justbur For the posterity. And if you learn new information about all this ;-) |
Wow, that's messy. How does this simplification sound? Emacs/Spacemacs
Vim/Spacemacs\1. Other Spacemacs's modifications would go where the user's customizations go, then the user is free to make additional modifications on top of that. |
@darkfeline I don't understand what you mean by "simplification". Are you referring to how it is presented to the user? I was just reporting the hierarchy as it actually exists. |
Yes, and how Spacemacs uses it, ideally, for example, keeping all of its bindings limited to a few levels instead of spreading them across all of them. |
Many keybindings are set by packages and i think it's fair to say that it's
|
Some more info. I played with ansi-term for a bit and at least part of the issue is evil-mode alone. If you emacs -Q and load evil-mode, undo-tree is enabled on C-/ and C-x is a prefix in term-char-mode. Since spacemacs always has evil-mode enabled this is will be the case with any editing style at the moment. |
(Edit: I initially commented on this with the misperception that this issue was closed. Now I realize the Autumnal Cleanup issue referenced right before this comment is closed, not this issue, anyway, back to the previously posted content): This is still routinely causing me problem on the latest master version. What's particularly painful is when I end up in some state where I need to send e.g. I can list several examples if people want, of program functionality which is inaccessible, or worse, programs which trap you in some submenu/state unless you can input a specific key. Ideally, you would have a way to pass any arbitrary input through to the underlying terminal, with the same mechanism for all of |
It's bound to |
Currently Evil breaks `term-char-mode` undo by enabling `undo-tree-mode`, see syl20bnr/spacemacs#4063 (comment) `turn-on-undo-tree-mode` checks the variable `undo-tree-incompatible-major-modes` before enabling `undo-tree-mode`, see https://github.com/emacs-evil/evil/blob/master/lib/undo-tree.el#L2618
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
With the current 'develop' branch, it seems that all 'top level' bindings are now available in term (char sub-mode) in both insert state and emacs state. This behaviour seems to have been introduced to as a fix for #3927, so this is evidently expected behaviour for some people. I would argue that this bug was a feature--the whole point of
term-char-mode
is that all keystrokes except for the escape key(s) are sent to the terminal. Any terminal app usingM-
keybindings is unusable with this behaviour.I would also argue that #4054 was fixed with a kludge. It was already possible to send C-z with
ESC C-z
, but the real problem was thatC-z
was available in term-char-mode.The text was updated successfully, but these errors were encountered: