0

I'm running emacsclient -nw and I notice sometimes the buffer appears to be in overwrite mode---I'll go to the beginning of a line and start typing, and when I do the existing text does not get pushed right. It looks like type-over.

However, if I C-x left C-x right to leave and come back to the buffer, I see the text did actually insert rather than overwrite. The text /has/ moved on a complete re-render.

There's nothing in the logs or messages indicating an error. But this is slow text overwrite/rendering behavior makes editing very clumsy if I have to leave the buffer and come back for it to re-render.

What could this be and how can I debug it? I am a loss on what to even call this behavior in order to google for a solution. Is it attributable to something like syntax coloring or flycheck?

phils
  • 48,657
  • 3
  • 76
  • 115
Mittenchops
  • 289
  • 1
  • 8
  • What terminal emulator do you use and what is the value of the `TERM` variable in your shell before you run emacs? (You can find out by running `echo $TERM` of course.) – db48x Jan 21 '23 at 19:19
  • xterm-color it looks like – Mittenchops Jan 26 '23 at 15:25
  • And what terminal do you actually use? Are you setting `TERM` to anything in your shell init file(s) (like `~/.bashrc`, `~/.zshrc`, etc)? – db48x Jan 26 '23 at 22:37
  • Eshell, but this is in any emacs buffer. – Mittenchops Jan 28 '23 at 08:22
  • 1
    No, the question is: which terminal are you running Emacs in? – phils Jan 28 '23 at 09:57
  • The value of $TERM is `xterm-color`. I am running Emacs from a bash terminal. – Mittenchops Jan 28 '23 at 19:31
  • 1
    Bash is a shell, just like Eshell is a shell. What terminal emulator is Bash running inside when you run Emacs? The terminal emulator is the program that actually draws things on your screen, and interprets the escape sequences sent by programs like Bash or Emacs. Different terminal emulators use different (often incompatible) sets of escape sequences, so it is important that Emacs know which set to use. It does this by examining the value of `TERM`. Are you setting `TERM` in your Bash init file(s)? If so, you may have set it to the wrong value. – db48x Jan 29 '23 at 00:18
  • I’m not setting TERM. The value of $TERM was what I posted above. What other information can I provide? – Mittenchops Jan 29 '23 at 04:32
  • This effect isn’t limited to eshell. All buffers are not rendering updates. – Mittenchops Jan 29 '23 at 04:33
  • "What other information can I provide?" -- well we are still waiting to learn the name of your terminal emulator (which has been asked for repeatedly). I understand that this question has caused you some confusion, but we cannot answer it for you, so you are going to need to do some research on your own in order to understand the question -- what a terminal emulator *is* and which one you are using -- so that you can provide the answer. We *suspect* the problem is a mis-match between your terminal and your TERM environment variable, but thus far you've only told us one of these two things. – phils Jan 30 '23 at 01:42
  • You could also run `xterm` (you may need to install it first) and find out whether you have the same problem with Emacs if you run it inside that terminal emulator. (I doubt you're currently using the actual `xterm` as it's not usually a default nowadays, but that *is* what you're telling Emacs you're using, so it'll be a useful comparison.) – phils Jan 30 '23 at 01:47
  • p.s. You could save time in future with a bit of pro-active research -- if someone asks you a question that you don't understand in a comments thread like this, search online to try to learn what it is you're being asked about. You will not only make the comments discussion quicker and easier that way, but you'll gain more knowledge in the process, which will benefit you further. – phils Jan 30 '23 at 01:58
  • @phils, I truly don’t know how to answer your question. I provided the output of the command you suggested. The terminal is a terminal. I am not emulating. It is simply a vanilla bash terminal. Are you asking me whether I am running inside tmux or something? I am not. – Mittenchops Jan 30 '23 at 06:18
  • I appreciate your help of course, and don’t mean to be difficult but I’m not clear on how to answer your question. – Mittenchops Jan 30 '23 at 06:22
  • 1
    You definitely are running some form of terminal emulator, unless you have an actual hardware terminal on your desk, connected to your computer with a serial cable. Here is a [picture of a DEC VT-100](https://en.wikipedia.org/wiki/Computer_terminal#/media/File:DEC_VT100_terminal_transparent.png), for example. I suggest following phils’ recommendation to try running `xterm` before you run Emacs. Running `xterm` will open a new (and possibly different–looking) terminal window with Bash running inside it. When you run Emacs inside that new terminal window, does it behave correctly? – db48x Jan 30 '23 at 08:25
  • "It is simply a vanilla bash terminal" -- as previously pointed out by @db48x, `bash` is not a terminal; it is a shell. Shells and terminals are *entirely* different things. Your terminal provides input/output capabilities allowing you to interact with other programs. Programs such as shells, emacs, and a vast array of others, can be connected to your terminal in order that you (the user) can interact with that process. But again, you can research this for yourself (and I recommend doing so, to help you to understand these systems better). – phils Jan 30 '23 at 08:38
  • It is normal that when you run a terminal emulator it in turn runs your shell as the initial process to be interacted with (which is likely why you are thinking of them as one and the same), but the terminal and the shell are two separate things. – phils Jan 30 '23 at 08:43
  • I am running windows terminal 1.15 then bash in WSL. – Mittenchops Jan 30 '23 at 15:59
  • Sorry, xterm implies an xserver, right? Maybe this is why I was confused, I am running with -t for terminal mode, not trying to use x server display. – Mittenchops Jan 30 '23 at 17:45
  • `xterm` is a terminal emulator which runs under an X display. Inside the xterm you can run `emacs` with the `-nw` or `-t` option. I know nothing about WSL but I presume it *does* provide an X display? If so, please do some testing in an `xterm` as suggested, and report whether the problem exists there. I know nothing about "windows terminal" either, but that name does nothing to dissuade me from the notion that your issue is being caused by an incorrect `TERM` value. – phils Jan 30 '23 at 21:25
  • Also, running emacs in Windows under WSL is such a niche approach that I urge you to mention this in the text of your questions *in general* as it may be highly relevant in some cases, and yet no one is going to expect it if you haven't mentioned it yourself. (I've added `microsoft-windows` and `wsl` to the tags on this occasion, as I expect your problem *is* connected to your windows terminal.) – phils Jan 30 '23 at 22:15
  • I am not running emacs in Windows under WSL. That's only my terminal emulator. I'm running emacs on a linux host that I ssh to. In my opinion, it's much easier to run emacs on linux. – Mittenchops Feb 01 '23 at 02:58

0 Answers0