I'd like terminal Emacs to observe the current value of cursor-style when the current terminal emulator supports commands to change the cursor.

For example: MinTTY is the default terminal emulator for Cygwin. According to this page, it supports changing cursor styles using the following escape sequences:

  • \e[1 q for a block cursor.
  • \e[5 q for a bar cursor.

Other terminal emulators that support these escapes include the VTE-based emulators (gnome-terminal and friends) and xterm and its derivatives.

Currently, hacks exist for evil-mode that attempt to simulate this support. Unfortunately, these break when the terminal doesn't support said escapes. Here's a question to see if that's fixable.

As far as I can tell, Emacs doesn't support changing the cursor natively. Is there any way we can support it without relying on a package like evil?

  • Do you want to change the cursor type globally, or to obey cursor-type in the current buffer? AFAIK Emacs doesn't support changing the cursor type according to the current buffer on text terminals, but you can set visible-cursor to switch between two cursors globally (I don't know whether that toggles between block and bar, but that could be changed in terminfo). Dec 22, 2015 at 14:33
  • 2
  • @Gilles I just discovered that this has already been solved by a package: evil-terminal-cursor-changer Unfortunately, said package is broken, but that's beyond the scope of this question.
    – PythonNut
    Dec 23, 2015 at 18:13
  • I don't think that question is a duplicate. While there may be solutions that work for both, the problems are pretty different. You might find a Mintty-specific solution; the other question might have an evil-specific solution. Were you specifically interested in changing the cursor according to the mode in evil? That's not what you asked here… Dec 23, 2015 at 19:12
  • If you clarify your question, someone may well find a solution that works for you. For one thing, the control sequences that Emacs sends to the terminal aren't hardcoded; if it's sending the wrong ones, that's fixable. It's only if it sends nothing for the event when you want to change the cursor type that you have a difficult problem, and even for that there might be a workaround. Dec 23, 2015 at 19:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.