1

I'm trying to change the cursor type in Emacs. Here are the steps I'm following,

  • C-h v cursor-type
  • check the value of cursor type. It is set to t.
  • start emacs with emacs -nw -Q and type (setq cursor-type 'bar).
  • move the cursor to the end of the line and press C-x C-e
  • check the value of cursor type. It is set to bar.

What result I'm expecting? The cursor type to change to bar.

What result I'm seeing? The cursor type remains default style.

I have tested the same steps with GUI version of Emacs. Launched via emacs -Q from terminal. I'm able to change the cursor type.

I have Mate desktop environment and running this in mate-terminal. The TERM is set to xterm and i have also tried with setting TERM to xterm-256color.

I'm using debian and my emacs version and configuration are as follows,

```

In GNU Emacs 25.0.94.1 (i686-pc-linux-gnu, GTK+ Version 2.24.25) of 2016-08-30 built on hari-laptop System Description: Debian GNU/Linux 8.5 (jessie)

Configured using: 'configure --with-xpm=no --with-jpeg=no --with-gif=no --with-tiff=no'

Configured features: PNG SOUND GSETTINGS NOTIFY FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK2 X11

Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t

Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Making completion list... [2 times]

Load-path shadows: None found.

Features: (shadow sort mail-extr emacsbug message dired format-spec rfc822 mml mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu cl-loaddefs pcase cl-lib mail-prsvr mail-utils term/xterm xterm time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information: ((conses 8 91186 5077) (symbols 24 19688 0) (miscs 20 34 138) (strings 16 14444 3826) (string-bytes 1 410993) (vectors 8 10488) (vector-slots 4 397081 4396) (floats 8 167 500) (intervals 28 192 14) (buffers 520 12) (heap 1024 30704 569))

```

2 Answers 2

5

On a terminal, you can't change the shape of cursor.

From the Emacs manual:

On a text terminal, the cursor’s appearance is controlled by the terminal, largely out of the control of Emacs. Some terminals offer two different cursors: a “visible” static cursor, and a “very visible” blinking cursor. By default, Emacs uses the very visible cursor, and switches to it when you start or resume Emacs. If the variable visible-cursor is nil when Emacs starts or resumes, it uses the normal cursor.

4
  • Changing the cursor type to bar in mate-terminal works. So it should also work when i configure in emacs right? I found a workaround by configuring the cursor type in mate-terminal. Changing the cursor type to I-Beam in preferences changes the cursor to bar and when i open emacs in terminal it shows the cursor as bar.
    – Hariharan
    Sep 4, 2016 at 13:12
  • Although mate-terminal allows you to do this through its configuration, it may not expose this capability to programs running inside it.
    – goedson
    Sep 4, 2016 at 18:20
  • Maybe i was not clear in the previous comment. If i set the cursor to bar in mate terminal, the cursor changes to bar in the terminal and the cursor inside emacs (without any configuration in init.el) is also shown as bar. But if i don't set any configuration in the mate-terminal and try to change the cursor type in emacs init.el it doesn't take effect in the terminal emacs.
    – Hariharan
    Sep 4, 2016 at 18:27
  • Sorry, typed enter too early. Like mate-terminal, when emacs is drawing its own window, it has total control of how the cursor is displayed. But inside a terminal (as in your case) it has no access to any API that allows it to change the shape of the cursor, so setting cursor-type in this situation has no effect. In some terminals, changing the shape of cursor may not even be an option (think of real text-based terminals).
    – goedson
    Sep 4, 2016 at 18:34
0

A quick fix on lxde terminal. On the menu-bar of lxde, Edit -> profiles -> preferences. then you can choose cursor -> nerver blink

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.