6

I would like to change the shape of the cursor to something like the following image:

enter image description here

It's a bit taller and thicker than the default one. How do I do that?

3

You can customize the value of cursor-type:

Documentation: Cursor to use when this buffer is in the selected window. Values are interpreted as follows:

t use the cursor specified for the frame

nil don't display a cursor

box display a filled box cursor

hollow display a hollow box cursor

bar display a vertical bar cursor with default width

(bar . WIDTH) display a vertical bar cursor with width WIDTH

hbar display a horizontal bar cursor with default height

(hbar . HEIGHT) display a horizontal bar cursor with height HEIGHT

ANYTHING ELSE display a hollow box cursor

It looks like you want something like (setf cursor-type 'bar)

  • 2
    Why do setf? (setq cursor-type '(bar . 4)) works just fine. I am asking because I don't know why one would do setf instead of setq; and I have never used setf :). – Kaushal Modi Jul 27 '15 at 14:40
  • 2
    @kaushalmodi: they're equivalent here; setf is actually a macro that will expand into setq in this situation. I had been learning Common Lisp, where setf is used pervasively, and now use it when my mind's on auto-pilot. – Dan Jul 27 '15 at 14:43
  • 1
    @Dan, I also use setf in Common Lisp, but it would be more idiomatic to use setq in Emacs Lisp. There is no difference of course, but people are generally expecting setq, so setf may confuse some people without Common Lisp background. For example, I love functional programming, but when I need to do Python, I will write [x for x in S if P(x)] instead of filter(P, S) -- which is clearer, no matter what creator of Python thinks :-D – Mark Karpov Jul 27 '15 at 16:01
  • I would use setf only when it's really useful, i.e. when its argument is some compound structure. But even in that case, setcar may be better than (setf (car ...) ...) in Emacs Lisp. – Mark Karpov Jul 27 '15 at 16:02
  • 1
    This answer only explains how one can widen the bar not make it taller. – devcom Mar 14 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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