Subject: Re: bug#9406: 24.0.50; Use M-p/M-n to navigate through the kill ring

From: David De La Harpe Golden <[email-masked]>
Date: Wed, 31 Aug 2011 16:47:37 +0100

On 31/08/11 14:01, Stefan Monnier wrote:
 > That doesn't sound like a bad idea, although of course it will annoy
 > a few users in a few corner cases (e.g. I have M-n and M-p bound in
 > smerge-mode).  So we might prefer to have it as an option.

I definitely do use various modes with M-n/M-p already bound (such as 
slime), they're often some "mode appropriate next/previous".  I expect I 
do hit them directly after a C-y sometimes too, though I suppose
in principle I could get used to not being able to (and I'm not exactly 
a new user who doesn't know how to alter bindings anyway...)

All the same, one alternative would be M-y and M-C-y after C-y for 
moving in opposite directions through the kill ring? Just tried it and 
it doesn't feel too bad to me, anyway.

(defun yank-pop-inv (&optional arg)
   (interactive "*p")
   (unless arg (setq arg 1))
   (let ((arg (- arg)))
     (yank-pop arg)))

(global-set-key (kbd "M-C-y") #'yank-pop-inv)

OTOH, "kill-ring-search" tends to be more useful than uni- or bi- 
directional navigation through the kill ring. The author suggests M-C-y 
as its default binding:
http://nschum.de/src/emacs/kill-ring-search/

So I'd also consider, given M-y is currently globally bound to a 
definition that isn't used except after C-y, putting kill-ring-search 
functionality on M-y when _not_ after C-y.

Then also add a kill-ring-search-next to the kill-ring-search prompt as 
M-C-y (it already has a kill-ring-search-prev on M-y).

That would also actually sort of fit in with C-y followed by M-y / M-C-y 
as suggested earlier above, as then C-y followed by M-y / M-C-y could be 
considered to be acting like the new M-y, with a null search string, 
inplace display, and implicit exit (while still also acting just like 
C-y M-y today!).

And could add M-n and M-p to the new M-y prompt where they'd feel 
"right", without having them have an effect after C-y (or with if 
preferred, of course).