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

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

bug#52417: Mark ring navigation could be two-way


From: Juri Linkov
Subject: bug#52417: Mark ring navigation could be two-way
Date: Sat, 11 Dec 2021 20:34:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

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





reply via email to

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