Post by Drew AdamsPost by Tassilo HornI guess the OP means `backward-kill-word' (<M-backspace>) and
friends. I'm also interested in something like that. I want to use
the word, line, and region editing commands in the minibuffer, but I
don't want to have the killed text in the global kill-ring.
I think you need deleting (non-killing) commands to remap the killing
Yes, that would be a possibility.
Post by Drew AdamsPost by Tassilo HornWhat I'd really like to have is a separate kill-ring for the
minibuffers. I've tried
(dolist (b (buffer-list))
(when (minibufferp b)
(set-buffer b)
(make-local-variable 'kill-ring)))
or entering a recursive edit
M-: M-: (make-local-variable 'kill-ring) RET C-g,
but that doesn't have an effect.
Try doing it on `minibuffer-setup-hook' instead.
(add-hook 'minibuffer-setup-hook
(lambda ()
(make-local-variable 'kill-ring)))
It doesn't work completely. The good thing is that the kills I make in
the minibuffer are not in the global kill-ring anymore. But when
reentering the minibuffer again, its value is again the global
kill-ring.
That looks to me as if on entering the minibuffer
`minibuffer-setup-hook' makes kill-ring buffer-local, but when the
minibuffer is left again, the buffer local variable is killed.
And in fact, advising `kill-all-local-variables' like so
--8<---------------cut here---------------start------------->8---
(defadvice kill-all-local-variables (before bla activate)
(message "killing all local vars of %s" (current-buffer)))
--8<---------------cut here---------------end--------------->8---
I get
killing all local vars of *Minibuf-1*
killing all local vars of *Minibuf-0*
killing all local vars of *Minibuf-1*
when leaving the minibuffer.
Using this advice, I think I finally got the intended behavior:
--8<---------------cut here---------------start------------->8---
(defadvice kill-all-local-variables (around th-keep-minibuffer-kill-ring activate)
(let ((b (current-buffer)))
(when (minibufferp b)
(let ((kr kill-ring))
ad-do-it
(set (make-local-variable 'kill-ring) kr)))))
--8<---------------cut here---------------end--------------->8---
Now, when reentering the minibuffer I can yank the stuff I killed in
previous minibuffer sessions, and those kills don't show up in the
global kill-ring.
But why are the buffer-local variables of minibuffers forcefully killed,
anyway?
Bye,
Tassilo