help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Jumping from one position to other position


From: Jean Louis
Subject: Re: Jumping from one position to other position
Date: Sun, 6 Dec 2020 08:24:20 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Drew Adams <drew.adams@oracle.com> [2020-12-06 00:30]:
> > All the time I have to jump from one function to other function. What
> > I used so far is C-SPC C-SPC to leave mark at the point and deactivate
> > it. Then I can jump to other places and come back with C-u SPC.
> > 
> > What I would like is to keep somehow automatically source position as
> > new mark, when I do C-u SPC at position X that I jump to position Y,
> > and then from Y with C-u SPC again back to X.
> > 
> > But Emacs does not work this way.
> > 
> > If anybody have better way of jumping from one place A to place B and
> > returning again to place A, and again to place B, let me know.
> 
> (`C-SPC') `C-x C-x'  Repeat to move back.
> `C-g' do deactivate region.

Thank you for references.

In some programming cases M-, and M-. can bring me to referenced or
referencing functions. It helps but is not same.

I think maybe to maybe function for a key to remember the current
marker and jump to last marker, then again same key to remember that
other marker and jump to last remembered.

It should be one key like s-m or similar, definitely not two or
combinations of too many keys. F5 would serve me better than current:
C-SPC C-SPC followed by C-u SPC that is not really doing what I mean
but is helpfull.

> There are also libraries that give you ways to
> browse among the marks, including by choosing
> the text surrounding them using completion.

Small stuff is better kept in one's own configuration then relying on
libraries. Then on each Emacs installation I would need to either
remember which is external library or make sure it is installed PLUS
using my own configuration. It is double action which I always try to
prevent.

(info "(emacs) Mark Ring") says:

,----
|    To return to a marked position, use ‘set-mark-command’ with a prefix
| argument: ‘C-u C-<SPC>’.  This moves point to where the mark was, and
| deactivates the mark if it was active.  Each subsequent ‘C-u C-<SPC>’
| jumps to a prior position stored in the mark ring.  The positions you
| move through in this way are not lost; they go to the end of the ring.
`----

Just that I am not satisfied with it. It does not bring me back how I
mean. I am using this for years.

But maybe this can help:

,----
|    The variable ‘mark-ring-max’ specifies the maximum number of entries
| to keep in the mark ring.  This defaults to 16 entries.  If that many
| entries exist and another one is pushed, the earliest one in the list is
| discarded.  Repeating ‘C-u C-<SPC>’ cycles through the positions
| currently in the ring.
`----

Because if I specify `mark-ring-max' to be 2 then maybe this is what I
need. So I will test this feature while programming. Majority of times
I jump back I do not want to jump to previous 3rd or 4th position but
just to previous position and back.

Useful logical jumping would be for me:

1 2 3 4 5 6 7 8 7 8 7 8 7 8
                ~~~~~~~~~~~
                this is where mode of jumping changes

then one could maybe decide to go back to mode to reach again 1-6
positions.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]