unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Block cursor in a tty
@ 2005-12-22 19:41 Stefan Monnier
  2005-12-23  0:15 ` David Kastrup
  2005-12-23 15:19 ` Richard M. Stallman
  0 siblings, 2 replies; 19+ messages in thread
From: Stefan Monnier @ 2005-12-22 19:41 UTC (permalink / raw)



Several people have complained on gnu.emacs.help that Emacs uses an ugly big
block cursor in their terminal emulator even after they've configured their
terminal emulator to use a more subdued cursor.

It turns out that the reason for it is that Emacs uses the termcap "vs"
command to make the cursor visible rather than "ve".  My manpages describe
the two commands as follows:

       cursor_normal                 cnorm      ve        make cursor appear
                                                          normal (undo
                                                          civis/cvvis)
       [...]
       cursor_visible                cvvis      vs        make cursor very
                                                          visible

Does anybody know why Emacs insists on using the big-block-cursor rather
than using whatever the user has selected as default?


        Stefan

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-22 19:41 Block cursor in a tty Stefan Monnier
@ 2005-12-23  0:15 ` David Kastrup
  2005-12-23 15:19 ` Richard M. Stallman
  1 sibling, 0 replies; 19+ messages in thread
From: David Kastrup @ 2005-12-23  0:15 UTC (permalink / raw)
  Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Several people have complained on gnu.emacs.help that Emacs uses an ugly big
> block cursor in their terminal emulator even after they've configured their
> terminal emulator to use a more subdued cursor.
>
> It turns out that the reason for it is that Emacs uses the termcap "vs"
> command to make the cursor visible rather than "ve".  My manpages describe
> the two commands as follows:
>
>        cursor_normal                 cnorm      ve        make cursor appear
>                                                           normal (undo
>                                                           civis/cvvis)
>        [...]
>        cursor_visible                cvvis      vs        make cursor very
>                                                           visible
>
> Does anybody know why Emacs insists on using the big-block-cursor rather
> than using whatever the user has selected as default?

A possible rationale would be that commands like C-x o jump to a
possibly surprising position on the screen, and you would not want to
look too long for locating it.

Personally, I think we should tend to default to the normal cursor,
and maybe provide the visible cursor as an option for people who
really want it.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-22 19:41 Block cursor in a tty Stefan Monnier
  2005-12-23  0:15 ` David Kastrup
@ 2005-12-23 15:19 ` Richard M. Stallman
  2005-12-23 15:38   ` Giorgos Keramidas
  1 sibling, 1 reply; 19+ messages in thread
From: Richard M. Stallman @ 2005-12-23 15:19 UTC (permalink / raw)
  Cc: emacs-devel

    Does anybody know why Emacs insists on using the big-block-cursor rather
    than using whatever the user has selected as default?

vs was defined specifically to be used by full-screen editors to make
the cursor more visible.

The default cursor is for sequential input.  With sequential input,
you know which line to look in, so it is easier to see the cursor;
thus, it does not need extra visibility.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-23 15:19 ` Richard M. Stallman
@ 2005-12-23 15:38   ` Giorgos Keramidas
  2005-12-23 20:47     ` Juri Linkov
  2005-12-24  2:36     ` Richard M. Stallman
  0 siblings, 2 replies; 19+ messages in thread
From: Giorgos Keramidas @ 2005-12-23 15:38 UTC (permalink / raw)
  Cc: Stefan Monnier, emacs-devel

        Does anybody know why Emacs insists on using the
        big-block-cursor rather than using whatever the user has
        selected as default?

    vs was defined specifically to be used by full-screen editors to
    make the cursor more visible.

    The default cursor is for sequential input.  With sequential input,
    you know which line to look in, so it is easier to see the cursor;
    thus, it does not need extra visibility.

Can we at least make it a customizable option?  I didn't look very much
into this, but it sure felt annoying when I first set the default cursor
of my consoles to non-block mode and found out that Emacs appeared to
'reset' the cursor to block mode.

- Giorgos

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-23 15:38   ` Giorgos Keramidas
@ 2005-12-23 20:47     ` Juri Linkov
  2005-12-24  2:36     ` Richard M. Stallman
  1 sibling, 0 replies; 19+ messages in thread
From: Juri Linkov @ 2005-12-23 20:47 UTC (permalink / raw)
  Cc: emacs-devel, rms, monnier

>         Does anybody know why Emacs insists on using the
>         big-block-cursor rather than using whatever the user has
>         selected as default?
>
>     vs was defined specifically to be used by full-screen editors to
>     make the cursor more visible.
>
>     The default cursor is for sequential input.  With sequential input,
>     you know which line to look in, so it is easier to see the cursor;
>     thus, it does not need extra visibility.
>
> Can we at least make it a customizable option?  I didn't look very much
> into this, but it sure felt annoying when I first set the default cursor
> of my consoles to non-block mode and found out that Emacs appeared to
> 'reset' the cursor to block mode.

Yes, it is annoying when Emacs overrides the default console cursor.
When the default console cursor is configured to non-blinking,
Emacs changes it to the blinking cursor.

A new customizable option or at least a command line option would be
a good thing.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-23 15:38   ` Giorgos Keramidas
  2005-12-23 20:47     ` Juri Linkov
@ 2005-12-24  2:36     ` Richard M. Stallman
  2005-12-24  4:26       ` Giorgos Keramidas
  1 sibling, 1 reply; 19+ messages in thread
From: Richard M. Stallman @ 2005-12-24  2:36 UTC (permalink / raw)
  Cc: monnier, emacs-devel

    Can we at least make it a customizable option?  I didn't look very much
    into this, but it sure felt annoying when I first set the default cursor
    of my consoles to non-block mode and found out that Emacs appeared to
    'reset' the cursor to block mode.

You can certainly control this by changing the termcap entry.

Could the terminal emulator let you specify how the visual mode
cursor should look?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-24  2:36     ` Richard M. Stallman
@ 2005-12-24  4:26       ` Giorgos Keramidas
  2005-12-25  2:51         ` Richard M. Stallman
  0 siblings, 1 reply; 19+ messages in thread
From: Giorgos Keramidas @ 2005-12-24  4:26 UTC (permalink / raw)
  Cc: monnier, emacs-devel

        Can we at least make it a customizable option?  I didn't
        look very much into this, but it sure felt annoying when
        I first set the default cursor of my consoles to
        non-block mode and found out that Emacs appeared to
        'reset' the cursor to block mode.

    You can certainly control this by changing the termcap entry.

    Could the terminal emulator let you specify how the visual mode
    cursor should look?

Possibly.  Not all terminal emulators support modifying the
termcap on the fly, and altering the termcap entry is sometimes
difficult for people who have no write access to the termcap
database or lack the expertise required to hack termcap entries.

Making things a little easier would be fine, IMHO :)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-24  4:26       ` Giorgos Keramidas
@ 2005-12-25  2:51         ` Richard M. Stallman
  2005-12-25  3:21           ` Giorgos Keramidas
  0 siblings, 1 reply; 19+ messages in thread
From: Richard M. Stallman @ 2005-12-25  2:51 UTC (permalink / raw)
  Cc: monnier, emacs-devel

I would not object to having an option to turn off use of vs.
However, it will be nontrivial to implement one, since term_init is
called before any Lisp code runs.  So it can't be controlled by the
init file.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-25  2:51         ` Richard M. Stallman
@ 2005-12-25  3:21           ` Giorgos Keramidas
  2005-12-26  2:19             ` Richard M. Stallman
  2005-12-26 16:20             ` Stefan Monnier
  0 siblings, 2 replies; 19+ messages in thread
From: Giorgos Keramidas @ 2005-12-25  3:21 UTC (permalink / raw)
  Cc: monnier, emacs-devel

    I would not object to having an option to turn off use of
    vs.  However, it will be nontrivial to implement one, since
    term_init is called before any Lisp code runs.  So it can't
    be controlled by the init file.

Currently, term_init sets TS_cursor_visible to tgetstr("vs", address),
which then gets used in set_terminal_modes().  We could probably add
term_init_cursor() and arrange for it to be called twice, once with the
default "vs" capability before the init file is loaded and once if the
init file specifies something different later on.  By making an option
that the init file can use to make TS_cursor_visible equal to
TS_cursor_normal, we're set :)

I'm not very acquainted with the way the terminal handling works though,
so it may take a time before I have a patch ready and tested.

- Giorgos

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-25  3:21           ` Giorgos Keramidas
@ 2005-12-26  2:19             ` Richard M. Stallman
  2005-12-26 16:20             ` Stefan Monnier
  1 sibling, 0 replies; 19+ messages in thread
From: Richard M. Stallman @ 2005-12-26  2:19 UTC (permalink / raw)
  Cc: monnier, emacs-devel

    Currently, term_init sets TS_cursor_visible to tgetstr("vs", address),
    which then gets used in set_terminal_modes().  We could probably add
    term_init_cursor() and arrange for it to be called twice, once with the
    default "vs" capability before the init file is loaded and once if the
    init file specifies something different later on.

Yes, it could be done.  It would not arrange to avoid touching the
cursor type at all, but it could set the cursor type back to ordinary.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-25  3:21           ` Giorgos Keramidas
  2005-12-26  2:19             ` Richard M. Stallman
@ 2005-12-26 16:20             ` Stefan Monnier
  2005-12-26 21:56               ` Richard M. Stallman
  1 sibling, 1 reply; 19+ messages in thread
From: Stefan Monnier @ 2005-12-26 16:20 UTC (permalink / raw)
  Cc: Richard M. Stallman, emacs-devel

>>>>> "Giorgos" == Giorgos Keramidas <keramida@ceid.upatras.gr> writes:

>     I would not object to having an option to turn off use of
>     vs.  However, it will be nontrivial to implement one, since
>     term_init is called before any Lisp code runs.  So it can't
>     be controlled by the init file.

> Currently, term_init sets TS_cursor_visible to tgetstr("vs", address),
> which then gets used in set_terminal_modes().  We could probably add
> term_init_cursor() and arrange for it to be called twice, once with the
> default "vs" capability before the init file is loaded and once if the
> init file specifies something different later on.  By making an option
> that the init file can use to make TS_cursor_visible equal to
> TS_cursor_normal, we're set :)

> I'm not very acquainted with the way the terminal handling works though,
> so it may take a time before I have a patch ready and tested.

> - Giorgos

Guaranteed 100% untested sample patch.
Doesn't include the update to cus-start.el to make it customizable.


        Stefan


--- term.c	20 oct 2005 15:44:27 -0400	1.170
+++ term.c	26 déc 2005 11:17:31 -0500	
@@ -87,6 +87,10 @@
 
 Lisp_Object Vring_bell_function;
 
+/* If non-nil, use "vs", otherwise use "ve" to make the cursor visible.  */
+
+Lisp_Object Vvisible_cursor;
+
 /* Terminal characteristics that higher levels want to look at.
    These are all extern'd in termchar.h */
 
@@ -460,7 +464,7 @@
 	    putchar ('\n');
 	}
 
-      OUTPUT_IF (TS_cursor_visible);
+      OUTPUT_IF (NILP (Vvisible_cursor) ? TS_cursor_normal : TS_cursor_visible);
       OUTPUT_IF (TS_keypad_mode);
       losecursor ();
     }
@@ -615,6 +619,7 @@
     {
       tty_cursor_hidden = 0;
       OUTPUT_IF (TS_cursor_normal);
+      if (!NILP (Vvisible_cursor))
       OUTPUT_IF (TS_cursor_visible);
     }
 }
@@ -2726,6 +2731,10 @@
 The function should accept no arguments.  */);
   Vring_bell_function = Qnil;
 
+  DEFVAR_LISP ("visible-cursor", &Vvisible_cursor,
+	       doc: /* Non-nil means to make the cursor very visible.  */);
+  Vvisible_cursor = Qt;
+
   defsubr (&Stty_display_color_p);
   defsubr (&Stty_display_color_cells);
   defsubr (&Stty_no_underline);

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-26 16:20             ` Stefan Monnier
@ 2005-12-26 21:56               ` Richard M. Stallman
  2005-12-27 15:55                 ` Stefan Monnier
  0 siblings, 1 reply; 19+ messages in thread
From: Richard M. Stallman @ 2005-12-26 21:56 UTC (permalink / raw)
  Cc: keramida, emacs-devel

    Guaranteed 100% untested sample patch.
    Doesn't include the update to cus-start.el to make it customizable.

To make that patch work, something has to call those functions again
after the init file runs.  I doubt that that happens now;
do you see a reason to think it does?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-26 21:56               ` Richard M. Stallman
@ 2005-12-27 15:55                 ` Stefan Monnier
  2005-12-27 23:14                   ` Richard M. Stallman
  0 siblings, 1 reply; 19+ messages in thread
From: Stefan Monnier @ 2005-12-27 15:55 UTC (permalink / raw)
  Cc: keramida, emacs-devel

>     Guaranteed 100% untested sample patch.
>     Doesn't include the update to cus-start.el to make it customizable.

> To make that patch work, something has to call those functions again
> after the init file runs.  I doubt that that happens now;
> do you see a reason to think it does?

I do see such reasons: write_glyphs calls tty_hide_cursor and update_end
calls tty_show_cursor.


        Stefan

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-27 15:55                 ` Stefan Monnier
@ 2005-12-27 23:14                   ` Richard M. Stallman
  2005-12-29  3:02                     ` Stefan Monnier
  0 siblings, 1 reply; 19+ messages in thread
From: Richard M. Stallman @ 2005-12-27 23:14 UTC (permalink / raw)
  Cc: keramida, emacs-devel

    I do see such reasons: write_glyphs calls tty_hide_cursor and update_end
    calls tty_show_cursor.

I'm surprised, but glad, that it is so easy.

Please install your patch.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-27 23:14                   ` Richard M. Stallman
@ 2005-12-29  3:02                     ` Stefan Monnier
  2005-12-29 10:21                       ` Giorgos Keramidas
  2005-12-30  2:17                       ` Richard M. Stallman
  0 siblings, 2 replies; 19+ messages in thread
From: Stefan Monnier @ 2005-12-29  3:02 UTC (permalink / raw)
  Cc: keramida, emacs-devel

>     I do see such reasons: write_glyphs calls tty_hide_cursor and update_end
>     calls tty_show_cursor.

> I'm surprised, but glad, that it is so easy.
> Please install your patch.

Actually, as mentioned, the patch is 100% guaranteed untested.
I don't know how to test it.


        Stefan

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-29  3:02                     ` Stefan Monnier
@ 2005-12-29 10:21                       ` Giorgos Keramidas
  2005-12-29 12:51                         ` Giorgos Keramidas
  2005-12-30  2:17                       ` Richard M. Stallman
  1 sibling, 1 reply; 19+ messages in thread
From: Giorgos Keramidas @ 2005-12-29 10:21 UTC (permalink / raw)
  Cc: rms, emacs-devel

On 2005-12-28 22:02, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> >     I do see such reasons: write_glyphs calls tty_hide_cursor and update_end
> >     calls tty_show_cursor.
>
> > I'm surprised, but glad, that it is so easy.
> > Please install your patch.
>
> Actually, as mentioned, the patch is 100% guaranteed untested.
> I don't know how to test it.

Running Emacs in a console terminal on FreeBSD, where the default cursor
has been configured in /etc/rc.conf with:

    cursor="destructive"        # Use an underline- instead of block-cursor

turns the cursor to block cursor immediately.  I'll patch my local Emacs
installation and report back later today, Stefan.  Thanks for coming up
with a patch so fast :)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-29 10:21                       ` Giorgos Keramidas
@ 2005-12-29 12:51                         ` Giorgos Keramidas
  2005-12-30 22:06                           ` Stefan Monnier
  0 siblings, 1 reply; 19+ messages in thread
From: Giorgos Keramidas @ 2005-12-29 12:51 UTC (permalink / raw)
  Cc: rms, emacs-devel

On 2005-12-29 12:21, Giorgos Keramidas <keramida@ceid.upatras.gr> wrote:
> On 2005-12-28 22:02, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> > >     I do see such reasons: write_glyphs calls tty_hide_cursor and
> > >     update_end calls tty_show_cursor.
> >
> > > I'm surprised, but glad, that it is so easy.
> > > Please install your patch.
> >
> > Actually, as mentioned, the patch is 100% guaranteed untested.
> > I don't know how to test it.
>
> Running Emacs in a console terminal on FreeBSD, where the default cursor
> has been configured in /etc/rc.conf with:
>
>     cursor="destructive"        # Use an underline- instead of block-cursor
>
> turns the cursor to block cursor immediately.  I'll patch my local Emacs
> installation and report back later today, Stefan.  Thanks for coming up
> with a patch so fast :)

Excellent.  All works as expected, and changes to cursor-visible from a
Lisp interaction buffer take effect automatically.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-29  3:02                     ` Stefan Monnier
  2005-12-29 10:21                       ` Giorgos Keramidas
@ 2005-12-30  2:17                       ` Richard M. Stallman
  1 sibling, 0 replies; 19+ messages in thread
From: Richard M. Stallman @ 2005-12-30  2:17 UTC (permalink / raw)
  Cc: keramida, emacs-devel

Since Giorgos says this patch works, please install it.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Block cursor in a tty
  2005-12-29 12:51                         ` Giorgos Keramidas
@ 2005-12-30 22:06                           ` Stefan Monnier
  0 siblings, 0 replies; 19+ messages in thread
From: Stefan Monnier @ 2005-12-30 22:06 UTC (permalink / raw)
  Cc: rms, emacs-devel

>> > >     I do see such reasons: write_glyphs calls tty_hide_cursor and
>> > >     update_end calls tty_show_cursor.
>> >
>> > > I'm surprised, but glad, that it is so easy.
>> > > Please install your patch.
>> >
>> > Actually, as mentioned, the patch is 100% guaranteed untested.
>> > I don't know how to test it.
>> 
>> Running Emacs in a console terminal on FreeBSD, where the default cursor
>> has been configured in /etc/rc.conf with:
>> 
>> cursor="destructive"        # Use an underline- instead of block-cursor
>> 
>> turns the cursor to block cursor immediately.  I'll patch my local Emacs
>> installation and report back later today, Stefan.  Thanks for coming up
>> with a patch so fast :)

> Excellent.  All works as expected, and changes to cursor-visible from a
> Lisp interaction buffer take effect automatically.

Thanks, installed.


        Stefan

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2005-12-30 22:06 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-22 19:41 Block cursor in a tty Stefan Monnier
2005-12-23  0:15 ` David Kastrup
2005-12-23 15:19 ` Richard M. Stallman
2005-12-23 15:38   ` Giorgos Keramidas
2005-12-23 20:47     ` Juri Linkov
2005-12-24  2:36     ` Richard M. Stallman
2005-12-24  4:26       ` Giorgos Keramidas
2005-12-25  2:51         ` Richard M. Stallman
2005-12-25  3:21           ` Giorgos Keramidas
2005-12-26  2:19             ` Richard M. Stallman
2005-12-26 16:20             ` Stefan Monnier
2005-12-26 21:56               ` Richard M. Stallman
2005-12-27 15:55                 ` Stefan Monnier
2005-12-27 23:14                   ` Richard M. Stallman
2005-12-29  3:02                     ` Stefan Monnier
2005-12-29 10:21                       ` Giorgos Keramidas
2005-12-29 12:51                         ` Giorgos Keramidas
2005-12-30 22:06                           ` Stefan Monnier
2005-12-30  2:17                       ` Richard M. Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).