unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Narrow cursor at end of line?
@ 2010-01-09 20:02 Adam Sjøgren
  2010-01-09 20:26 ` Pascal J. Bourguignon
  0 siblings, 1 reply; 7+ messages in thread
From: Adam Sjøgren @ 2010-01-09 20:02 UTC (permalink / raw)
  To: help-gnu-emacs

XEmacs indicates that point is at the end of a line by making the cursor
slightly less wide. How do I make GNU Emacs do the same?


  Best regards,

    Adam

-- 
 "This is either madness... or brilliance."                   Adam Sjøgren
 "It's remarkable how often those two traits coincide."  asjo@koldfront.dk


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

* Re: Narrow cursor at end of line?
  2010-01-09 20:02 Narrow cursor at end of line? Adam Sjøgren
@ 2010-01-09 20:26 ` Pascal J. Bourguignon
  2010-01-09 21:04   ` Adam Sjøgren
  0 siblings, 1 reply; 7+ messages in thread
From: Pascal J. Bourguignon @ 2010-01-09 20:26 UTC (permalink / raw)
  To: help-gnu-emacs

asjo@koldfront.dk (Adam Sjøgren) writes:

> XEmacs indicates that point is at the end of a line by making the cursor
> slightly less wide. How do I make GNU Emacs do the same?

I guess you could change the cursor-type when it's at the end of line.
See the variable: cursor-type


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


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

* Re: Narrow cursor at end of line?
  2010-01-09 20:26 ` Pascal J. Bourguignon
@ 2010-01-09 21:04   ` Adam Sjøgren
  2010-01-10  2:20     ` Pascal J. Bourguignon
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Adam Sjøgren @ 2010-01-09 21:04 UTC (permalink / raw)
  To: help-gnu-emacs

On Sat, 09 Jan 2010 21:26:02 +0100, Pascal wrote:

> asjo@koldfront.dk (Adam Sjøgren) writes:

>> XEmacs indicates that point is at the end of a line by making the cursor
>> slightly less wide. How do I make GNU Emacs do the same?

> I guess you could change the cursor-type when it's at the end of line.
> See the variable: cursor-type

Ah, nice - thanks for the pointer.

I guess what I want to do is to have cursor-type set to (bar . 6) at the
end of the line and t otherwise. Perhaps something like:

  (defun asjo-indicate-end-of-line ()
    "Change the cursor to a narrow one when at the end of line"
    (if (eq (point) (line-end-position))
        (setq cursor-type '(bar . 6))
      (setq cursor-type t)))

I would need a hook called every time point is moved (or any time it is
moved to/from end of line) or add an advice to something, I guess?

I have looked though the list found with M-x apropos hook, but couldn't
really a good candidate...


  Best regards,

    Adam

-- 
 "I'm a driver, I'm a winner, things are gonna change,        Adam Sjøgren
  I can feel it."                                        asjo@koldfront.dk


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

* Re: Narrow cursor at end of line?
  2010-01-09 21:04   ` Adam Sjøgren
@ 2010-01-10  2:20     ` Pascal J. Bourguignon
  2010-01-10 12:55       ` Adam Sjøgren
  2010-01-10  6:47     ` Lennart Borgman
  2010-01-11 16:46     ` Stefan Monnier
  2 siblings, 1 reply; 7+ messages in thread
From: Pascal J. Bourguignon @ 2010-01-10  2:20 UTC (permalink / raw)
  To: help-gnu-emacs

asjo@koldfront.dk (Adam Sjøgren) writes:

> On Sat, 09 Jan 2010 21:26:02 +0100, Pascal wrote:
>
>> asjo@koldfront.dk (Adam Sjøgren) writes:
>
>>> XEmacs indicates that point is at the end of a line by making the cursor
>>> slightly less wide. How do I make GNU Emacs do the same?
>
>> I guess you could change the cursor-type when it's at the end of line.
>> See the variable: cursor-type
>
> Ah, nice - thanks for the pointer.
>
> I guess what I want to do is to have cursor-type set to (bar . 6) at the
> end of the line and t otherwise. Perhaps something like:
>
>   (defun asjo-indicate-end-of-line ()
>     "Change the cursor to a narrow one when at the end of line"
>     (if (eq (point) (line-end-position))
>         (setq cursor-type '(bar . 6))
>       (setq cursor-type t)))
>
> I would need a hook called every time point is moved (or any time it is
> moved to/from end of line) or add an advice to something, I guess?
>
> I have looked though the list found with M-x apropos hook, but couldn't
> really a good candidate...

You can do that after a command is executed: post-command-hook

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


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

* Re: Narrow cursor at end of line?
  2010-01-09 21:04   ` Adam Sjøgren
  2010-01-10  2:20     ` Pascal J. Bourguignon
@ 2010-01-10  6:47     ` Lennart Borgman
  2010-01-11 16:46     ` Stefan Monnier
  2 siblings, 0 replies; 7+ messages in thread
From: Lennart Borgman @ 2010-01-10  6:47 UTC (permalink / raw)
  To: Adam Sjøgren; +Cc: help-gnu-emacs

On Sat, Jan 9, 2010 at 10:04 PM, Adam Sjøgren <asjo@koldfront.dk> wrote:
>
> I would need a hook called every time point is moved (or any time it is
> moved to/from end of line) or add an advice to something, I guess?
>
> I have looked though the list found with M-x apropos hook, but couldn't
> really a good candidate...

post-command-hook?




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

* Re: Narrow cursor at end of line?
  2010-01-10  2:20     ` Pascal J. Bourguignon
@ 2010-01-10 12:55       ` Adam Sjøgren
  0 siblings, 0 replies; 7+ messages in thread
From: Adam Sjøgren @ 2010-01-10 12:55 UTC (permalink / raw)
  To: help-gnu-emacs

On Sun, 10 Jan 2010 03:20:44 +0100, Pascal wrote:

> asjo@koldfront.dk (Adam Sjøgren) writes:

>> I have looked though the list found with M-x apropos hook, but couldn't
>> really a good candidate...

> You can do that after a command is executed: post-command-hook

On Sun, 10 Jan 2010 07:47:12 +0100, Lennart wrote:

> post-command-hook?

Thanks to both of you - that was exactly the help I needed.


  Best wishes,

    Adam

-- 
 "riverrun, past Eve and Adam's, from swerve of shore         Adam Sjøgren
  to bend of bay, brings us by a commodius vicus of      asjo@koldfront.dk
  recirculation back to Howth Castle and Environs."


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

* Re: Narrow cursor at end of line?
  2010-01-09 21:04   ` Adam Sjøgren
  2010-01-10  2:20     ` Pascal J. Bourguignon
  2010-01-10  6:47     ` Lennart Borgman
@ 2010-01-11 16:46     ` Stefan Monnier
  2 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2010-01-11 16:46 UTC (permalink / raw)
  To: help-gnu-emacs

>     (if (eq (point) (line-end-position))
>         (setq cursor-type '(bar . 6))
>       (setq cursor-type t)))

You mean

     (setq cursor-type (if (eolp) '(bar . 6) t))

> I would need a hook called every time point is moved (or any time it is
> moved to/from end of line) or add an advice to something, I guess?

Actually, it's only every time the cursor is moved (point can be moved
many times internally over the course of a single command).  I.e. at
every redisplay.  There is sadly no hook for that (yet?), but you can
use post-command-hook as a good first approximation.


        Stefan


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

end of thread, other threads:[~2010-01-11 16:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-09 20:02 Narrow cursor at end of line? Adam Sjøgren
2010-01-09 20:26 ` Pascal J. Bourguignon
2010-01-09 21:04   ` Adam Sjøgren
2010-01-10  2:20     ` Pascal J. Bourguignon
2010-01-10 12:55       ` Adam Sjøgren
2010-01-10  6:47     ` Lennart Borgman
2010-01-11 16:46     ` Stefan Monnier

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).