* Free cursor movement beyond the end of line
@ 2018-05-14 6:32 yegupov
2018-05-14 8:16 ` Marcin Borkowski
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: yegupov @ 2018-05-14 6:32 UTC (permalink / raw)
To: help-gnu-emacs
Hello.
There is popular text editors option "allow cursor movement end of line".
It was implemented in many of text editors long time ago.
But it seems that it's absent in emacs (yes, I tried set-goal-column, picture-mode, artist-mode).
For example when I edit the text:
------------------------------
this is my long line|
short line
this is my other long line
------------------------------
What I need:
- when press "down" key cursor should keep position at column 21:
------------------------------
this is my long line
short line |
this is my other long line
------------------------------
- buffer shouldn't be modified because of cursor movement only, no need to surprising trailing spaces;
- keys like C-e should move cursor to the REAL end of line:
------------------------------
this is my long line
short line|
this is my other long line
------------------------------
- this should be worked ok with visual-line-mode mode too
Notes
- set-goal-column seems a something close about that but not exactly
- artist-mode and picture-mode unfortunatelly add extra spaces and has surprice behavour in visual-line-mode
Is there a way to solve somehow this problem in emacs?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Free cursor movement beyond the end of line
2018-05-14 6:32 Free cursor movement beyond the end of line yegupov
@ 2018-05-14 8:16 ` Marcin Borkowski
2018-05-14 8:16 ` Daniel Herzig
2018-05-14 16:31 ` yegupov
2 siblings, 0 replies; 8+ messages in thread
From: Marcin Borkowski @ 2018-05-14 8:16 UTC (permalink / raw)
To: yegupov; +Cc: help-gnu-emacs
On 2018-05-14, at 08:32, yegupov@gmail.com wrote:
> Hello.
>
> There is popular text editors option "allow cursor movement end of line".
> It was implemented in many of text editors long time ago.
>
> But it seems that it's absent in emacs (yes, I tried set-goal-column, picture-mode, artist-mode).
> Notes
> - set-goal-column seems a something close about that but not exactly
> - artist-mode and picture-mode unfortunatelly add extra spaces and has surprice behavour in visual-line-mode
One workaround could be to delete-trailing-whitespace on save.
Hth,
--
Marcin Borkowski
http://mbork.pl
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Free cursor movement beyond the end of line
2018-05-14 6:32 Free cursor movement beyond the end of line yegupov
2018-05-14 8:16 ` Marcin Borkowski
@ 2018-05-14 8:16 ` Daniel Herzig
2018-05-14 12:52 ` Stefan Monnier
2018-05-14 16:31 ` yegupov
2 siblings, 1 reply; 8+ messages in thread
From: Daniel Herzig @ 2018-05-14 8:16 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
<yegupov@gmail.com> writes:
Hello,
I recently discovered rectangle-mode -- maybe it does what you want.
If you hit C-x SPC at the end of your long line you can press "down" and
will land exactly in the column below. It will not place any whitespace at
the and of your short line. If you hit C-g then, the cursor lands at the
end of the short line.
Best regards,
Daniel
> Hello.
>
> There is popular text editors option "allow cursor movement end of line".
> It was implemented in many of text editors long time ago.
>
> But it seems that it's absent in emacs (yes, I tried set-goal-column, picture-mode, artist-mode).
>
>
> For example when I edit the text:
> ------------------------------
> this is my long line|
> short line
> this is my other long line
> ------------------------------
>
> What I need:
>
> - when press "down" key cursor should keep position at column 21:
> ------------------------------
> this is my long line
> short line |
> this is my other long line
> ------------------------------
>
> - buffer shouldn't be modified because of cursor movement only, no need to surprising trailing spaces;
>
> - keys like C-e should move cursor to the REAL end of line:
> ------------------------------
> this is my long line
> short line|
> this is my other long line
> ------------------------------
> - this should be worked ok with visual-line-mode mode too
>
>
> Notes
> - set-goal-column seems a something close about that but not exactly
> - artist-mode and picture-mode unfortunatelly add extra spaces and has surprice behavour in visual-line-mode
>
>
> Is there a way to solve somehow this problem in emacs?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Free cursor movement beyond the end of line
2018-05-14 8:16 ` Daniel Herzig
@ 2018-05-14 12:52 ` Stefan Monnier
2018-05-14 15:21 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2018-05-14 12:52 UTC (permalink / raw)
To: help-gnu-emacs
>> There is popular text editors option "allow cursor movement end of line".
>> It was implemented in many of text editors long time ago.
>>
>> But it seems that it's absent in emacs (yes, I tried set-goal-column,
>> picture-mode, artist-mode).
It's called quarter-plane-mode and is available from GNU ELPA.
But don't expect miracles from it.
>> - artist-mode and picture-mode unfortunatelly add extra spaces and has
>> surprice behavour in visual-line-mode
The extra spaces should normally be deleted upon save, so they should
not make a difference except for display line-wrapping
(quarter-plane-mode uses the same technique of inserting&removing spaces
as needed; actually uses code from picture-mode internally).
> I recently discovered rectangle-mode -- maybe it does what you want.
Indeed, rectangle-mode has some code that does something related, but it
only handles the part of *displaying* the cursor where there's no actual
text, it doesn't try to let you then insert text at that position.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Free cursor movement beyond the end of line
2018-05-14 12:52 ` Stefan Monnier
@ 2018-05-14 15:21 ` Eli Zaretskii
2018-05-15 1:27 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2018-05-14 15:21 UTC (permalink / raw)
To: help-gnu-emacs
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Mon, 14 May 2018 08:52:15 -0400
>
> > I recently discovered rectangle-mode -- maybe it does what you want.
>
> Indeed, rectangle-mode has some code that does something related, but it
> only handles the part of *displaying* the cursor where there's no actual
> text, it doesn't try to let you then insert text at that position.
cua-rectangle-mark-mode does, AFAIR.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Free cursor movement beyond the end of line
2018-05-14 6:32 Free cursor movement beyond the end of line yegupov
2018-05-14 8:16 ` Marcin Borkowski
2018-05-14 8:16 ` Daniel Herzig
@ 2018-05-14 16:31 ` yegupov
2018-05-17 14:50 ` Stefan Monnier
2 siblings, 1 reply; 8+ messages in thread
From: yegupov @ 2018-05-14 16:31 UTC (permalink / raw)
To: help-gnu-emacs
Thanks! quater-plane more really most close to desired. But really without miracles.
The remained thing is to discover the way to make "modified" flag ignore spaces-only modifications
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Free cursor movement beyond the end of line
2018-05-14 15:21 ` Eli Zaretskii
@ 2018-05-15 1:27 ` Stefan Monnier
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2018-05-15 1:27 UTC (permalink / raw)
To: help-gnu-emacs
>> > I recently discovered rectangle-mode -- maybe it does what you want.
>> Indeed, rectangle-mode has some code that does something related, but it
>> only handles the part of *displaying* the cursor where there's no actual
>> text, it doesn't try to let you then insert text at that position.
> cua-rectangle-mark-mode does, AFAIR.
It offers some more ad-hoc commands than rectangle-mark-mode, but it
basically suffers from the same problem: it doesn't let you run "any
command" at "any position", contrary to quarter-plane-mode.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Free cursor movement beyond the end of line
2018-05-14 16:31 ` yegupov
@ 2018-05-17 14:50 ` Stefan Monnier
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2018-05-17 14:50 UTC (permalink / raw)
To: help-gnu-emacs
> The remained thing is to discover the way to make "modified" flag
> ignore spaces-only modifications
Fundamentally, it should be fairly easy, but given the way it's
currently implemented it's a bit inconvenient.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-05-17 14:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-14 6:32 Free cursor movement beyond the end of line yegupov
2018-05-14 8:16 ` Marcin Borkowski
2018-05-14 8:16 ` Daniel Herzig
2018-05-14 12:52 ` Stefan Monnier
2018-05-14 15:21 ` Eli Zaretskii
2018-05-15 1:27 ` Stefan Monnier
2018-05-14 16:31 ` yegupov
2018-05-17 14:50 ` 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).