unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52417: Mark ring navigation could be two-way
@ 2021-12-10 21:20 ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-11 15:44 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-13  1:17 ` Dmitry Gutov
  0 siblings, 2 replies; 8+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-10 21:20 UTC (permalink / raw)
  To: 52417

Other tools has similar features like the mark ring and they
provide two-way navigation, so you can go back to some previous
position to check something, and then you can go forward in the
ring to get back to a more recent position or the latest position
if you want.

Emacs could have this too by providing a command which allows
moving forward in the mark ring.





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

* bug#52417: Mark ring navigation could be two-way
  2021-12-10 21:20 bug#52417: Mark ring navigation could be two-way ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-11 15:44 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-11 18:34   ` Juri Linkov
  2021-12-11 20:11   ` André A. Gomes
  2021-12-13  1:17 ` Dmitry Gutov
  1 sibling, 2 replies; 8+ messages in thread
From: Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-11 15:44 UTC (permalink / raw)
  To: 52417; +Cc: laszlomail

ndame via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@gnu.org> writes:

> Other tools has similar features like the mark ring and they
> provide two-way navigation, so you can go back to some previous
> position to check something, and then you can go forward in the
> ring to get back to a more recent position or the latest position
> if you want.
>
> Emacs could have this too by providing a command which allows
> moving forward in the mark ring.

+1.  I agree that this is a useful feature that would improve the text
editing capabilities of Emacs.  In Vim, you can use C-i and C-o to
navigate forwards and backwards, respectively.

A similar thing happens with the kill-ring.  M-y moves the last-yank
pointer in one direction, but there could be a command to move it in the
opposite direction.  Even if the mark and kill ring cycle, it is
inconvenient to browse them in one direction only, because as modern
computers have more memory available, the rings can store more things.

This is probably one of the reasons why there are a lot of external
packages that let you browse the contents of the mark-ring and kill-ring
in the minibuffer or a separate buffer.





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

* bug#52417: Mark ring navigation could be two-way
  2021-12-11 15:44 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-11 18:34   ` Juri Linkov
  2021-12-11 20:11   ` André A. Gomes
  1 sibling, 0 replies; 8+ messages in thread
From: Juri Linkov @ 2021-12-11 18:34 UTC (permalink / raw)
  To: 52417; +Cc: laszlomail, mardani29

>> Other tools has similar features like the mark ring and they
>> provide two-way navigation, so you can go back to some previous
>> position to check something, and then you can go forward in the
>> ring to get back to a more recent position or the latest position
>> if you want.
>>
>> Emacs could have this too by providing a command which allows
>> moving forward in the mark ring.
>
> +1.  I agree that this is a useful feature that would improve the text
> editing capabilities of Emacs.  In Vim, you can use C-i and C-o to
> navigate forwards and backwards, respectively.
>
> A similar thing happens with the kill-ring.  M-y moves the last-yank
> pointer in one direction, but there could be a command to move it in the
> opposite direction.  Even if the mark and kill ring cycle, it is
> inconvenient to browse them in one direction only, because as modern
> computers have more memory available, the rings can store more things.
>
> This is probably one of the reasons why there are a lot of external
> packages that let you browse the contents of the mark-ring and kill-ring
> in the minibuffer or a separate buffer.

After enabling repeat-mode, this browses the kill-ring with
'M-y up down up down ...'

  (defvar yank-pop-repeat-map
    (let ((map (make-sparse-keymap)))
      (define-key map "\M-y" 'yank-pop)
      (define-key map [up] 'yank-pop)
      (define-key map [down] (lambda ()
                               (interactive)
                               (setq repeat-map 'yank-pop-repeat-map)
                               (yank-pop -1)))
      map)
    "Keymap to repeat `yank-pop' key sequences.  Used in `repeat-mode'.")

  (put 'yank-pop 'repeat-map 'yank-pop-repeat-map)

The same can be created for the mark-ring.





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

* bug#52417: Mark ring navigation could be two-way
  2021-12-11 15:44 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-11 18:34   ` Juri Linkov
@ 2021-12-11 20:11   ` André A. Gomes
  1 sibling, 0 replies; 8+ messages in thread
From: André A. Gomes @ 2021-12-11 20:11 UTC (permalink / raw)
  To: 52417; +Cc: laszlomail, mardani29

Daniel Martín via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> ndame via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" <bug-gnu-emacs@gnu.org> writes:
>
>> Other tools has similar features like the mark ring and they
>> provide two-way navigation, so you can go back to some previous
>> position to check something, and then you can go forward in the
>> ring to get back to a more recent position or the latest position
>> if you want.
>>
>> Emacs could have this too by providing a command which allows
>> moving forward in the mark ring.
>
> +1.  I agree that this is a useful feature that would improve the text
> editing capabilities of Emacs.  In Vim, you can use C-i and C-o to
> navigate forwards and backwards, respectively.
>
> A similar thing happens with the kill-ring.  M-y moves the last-yank
> pointer in one direction, but there could be a command to move it in the
> opposite direction.  Even if the mark and kill ring cycle, it is
> inconvenient to browse them in one direction only, because as modern
> computers have more memory available, the rings can store more things.
>
> This is probably one of the reasons why there are a lot of external
> packages that let you browse the contents of the mark-ring and kill-ring
> in the minibuffer or a separate buffer.

Regarding M-y, you can use negative prefixes to move in the opposite
direction.

Regarding the mark ring, I don't think it's possible.  If indeed it's
not, I think it's a good idea to add such functionality.


-- 
André A. Gomes
"Free Thought, Free World"





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

* bug#52417: Mark ring navigation could be two-way
  2021-12-10 21:20 bug#52417: Mark ring navigation could be two-way ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-11 15:44 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-13  1:17 ` Dmitry Gutov
  2021-12-13  8:44   ` Juri Linkov
  1 sibling, 1 reply; 8+ messages in thread
From: Dmitry Gutov @ 2021-12-13  1:17 UTC (permalink / raw)
  To: ndame, 52417

On 11.12.2021 00:20, ndame via Bug reports for GNU Emacs, the Swiss army 
knife of text editors wrote:
> Other tools has similar features like the mark ring and they
> provide two-way navigation, so you can go back to some previous
> position to check something, and then you can go forward in the
> ring to get back to a more recent position or the latest position
> if you want.
> 
> Emacs could have this too by providing a command which allows
> moving forward in the mark ring.

FWIW, we've recently added xref-go-forward, bound to 'C-M-,', which 
pairs with xref-go-back (which was renamed at the same time), bound to 
'M-,'.

A fair number of commands both push to mark ring and call 
xref-push-marker-stack, so you might find this useful.





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

* bug#52417: Mark ring navigation could be two-way
  2021-12-13  1:17 ` Dmitry Gutov
@ 2021-12-13  8:44   ` Juri Linkov
  2021-12-13 15:09     ` bug#52417: [External] : " Drew Adams
  2021-12-13 15:15     ` Dmitry Gutov
  0 siblings, 2 replies; 8+ messages in thread
From: Juri Linkov @ 2021-12-13  8:44 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 52417, ndame

>> Emacs could have this too by providing a command which allows
>> moving forward in the mark ring.
>
> FWIW, we've recently added xref-go-forward, bound to 'C-M-,', which pairs
> with xref-go-back (which was renamed at the same time), bound to 'M-,'.
>
> A fair number of commands both push to mark ring and call
> xref-push-marker-stack, so you might find this useful.

Another idea: add a command that will display a *xref* buffer
with lines of locations extracted from the global-mark-ring.
This will allow visiting mark locations from the mark list.
Maybe this can be implemented by just adding a new xref backend?





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

* bug#52417: [External] : bug#52417: Mark ring navigation could be two-way
  2021-12-13  8:44   ` Juri Linkov
@ 2021-12-13 15:09     ` Drew Adams
  2021-12-13 15:15     ` Dmitry Gutov
  1 sibling, 0 replies; 8+ messages in thread
From: Drew Adams @ 2021-12-13 15:09 UTC (permalink / raw)
  To: Juri Linkov, Dmitry Gutov; +Cc: 52417@debbugs.gnu.org, ndame

> Another idea: add a command that will display a *xref* buffer
> with lines of locations extracted from the global-mark-ring.
> This will allow visiting mark locations from the mark list.

FWIW, I added this to Icicles on Dec 16, 2006.

By default, in Icicle mode there are these
multi-commands:

1. `C-SPC is bound' to
`icicle-goto-marker-or-set-mark-command'.

Goes to a marker or sets the mark.
No prefix arg or prefix arg > 0: `set-mark-command'.
Prefix arg < 0: goes to a local marker you choose.
Prefix arg = 0: goes to global or local marker.

Completion candidates are text of the marker's
line.

2. `C-x C-SPC' is bound to
`icicle-goto-global-marker-or-pop-global-mark'.

Goes to a global marker or pops the global mark.
Prefix arg < 0: goes to global marker you choose.
Otherwise, this is `pop-global-mark'.

Completion candidates can be multi-completions,
with two parts: (1) marker's buffer name, (2) text
from marker's line.  You can match either or both
parts, to narrow the choices.

By default, candidates are sorted in buffer order
and then marker order (buffer position).  As usual,
you can change the sort order on the fly.
___

A "multi-command" means that you can, with a single
command invocation, act multiple times, e.g. on
different completion candidates.  So you can move
around among marker positions, including cycling
in buffer order (or other orders).





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

* bug#52417: Mark ring navigation could be two-way
  2021-12-13  8:44   ` Juri Linkov
  2021-12-13 15:09     ` bug#52417: [External] : " Drew Adams
@ 2021-12-13 15:15     ` Dmitry Gutov
  1 sibling, 0 replies; 8+ messages in thread
From: Dmitry Gutov @ 2021-12-13 15:15 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 52417, ndame

On 13.12.2021 11:44, Juri Linkov wrote:
> Another idea: add a command that will display a*xref*  buffer
> with lines of locations extracted from the global-mark-ring.
> This will allow visiting mark locations from the mark list.
> Maybe this can be implemented by just adding a new xref backend?
> 

An Xref backend is something used automatically. This one would shadow 
some "real" backends that provide code navigation, for example.

But we could have a command which lists the entries from 
global-mark-ring in an Xref results buffer, allowing navigation across 
them, or jumping to a specific one.

But I guess one problem is xref--show-xrefs also pushes mark to mark 
ring (including the global one). So using the aforementioned command 
would automatically alter its results list.

But maybe it's not too much of a problem.





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

end of thread, other threads:[~2021-12-13 15:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 21:20 bug#52417: Mark ring navigation could be two-way ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-11 15:44 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-11 18:34   ` Juri Linkov
2021-12-11 20:11   ` André A. Gomes
2021-12-13  1:17 ` Dmitry Gutov
2021-12-13  8:44   ` Juri Linkov
2021-12-13 15:09     ` bug#52417: [External] : " Drew Adams
2021-12-13 15:15     ` Dmitry Gutov

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