* when deleting in minibuffer, don't change kill-ring
@ 2011-10-27 16:35 filebat Mark
2011-10-27 16:52 ` Drew Adams
0 siblings, 1 reply; 8+ messages in thread
From: filebat Mark @ 2011-10-27 16:35 UTC (permalink / raw
To: help-gnu-emacs; +Cc: Denny Zhang
[-- Attachment #1: Type: text/plain, Size: 144 bytes --]
hi all
Any idea how to prohibit kill-ring being changed, when I press
"backspace" key in minibuffer?
--
Thanks & Regards
Denny Zhang
[-- Attachment #2: Type: text/html, Size: 203 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: when deleting in minibuffer, don't change kill-ring
2011-10-27 16:35 when deleting in minibuffer, don't change kill-ring filebat Mark
@ 2011-10-27 16:52 ` Drew Adams
2011-10-27 18:23 ` Tassilo Horn
0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2011-10-27 16:52 UTC (permalink / raw
To: 'filebat Mark', help-gnu-emacs; +Cc: 'Denny Zhang'
> how to prohibit kill-ring being changed, when I press
> "backspace" key in minibuffer?
It is _not_ changed. Provide a recipe, starting from emacs -Q.
If you do need to change the binding of the key for some reason, then do so in
each of the minibuffer key maps. E.g.,
(define minibuffer-local-must-match-map (kbd "DEL")
'backward-delete-char)
etc.
But AFAICT, the global binding of DEL (and <backspace>) is in effect in the
minibuffer, and the global binding does not kill a char, it deletes it.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: when deleting in minibuffer, don't change kill-ring
2011-10-27 16:52 ` Drew Adams
@ 2011-10-27 18:23 ` Tassilo Horn
2011-10-27 18:38 ` Peter Dyballa
2011-10-27 21:53 ` Drew Adams
0 siblings, 2 replies; 8+ messages in thread
From: Tassilo Horn @ 2011-10-27 18:23 UTC (permalink / raw
To: help-gnu-emacs
"Drew Adams" <drew.adams@oracle.com> writes:
>> how to prohibit kill-ring being changed, when I press "backspace" key
>> in minibuffer?
>
> It is _not_ changed. Provide a recipe, starting from emacs -Q.
>
> If you do need to change the binding of the key for some reason, then
> do so in each of the minibuffer key maps. E.g.,
>
> (define minibuffer-local-must-match-map (kbd "DEL")
> 'backward-delete-char)
> etc.
>
> But AFAICT, the global binding of DEL (and <backspace>) is in effect
> in the minibuffer, and the global binding does not kill a char, it
> deletes it.
I 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.
What 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. Isn't it possible to have buffer local
values for variables defined at the C level?
Another observation: why are there more than one minibuffers? Right
now, I have 4:
(dolist (b (buffer-list))
(when (minibufferp b)
(insert (format "%s is a minibuffer\n" b)))) ;; C-j
*Minibuf-1* is a minibuffer
*Minibuf-2* is a minibuffer
*Minibuf-3* is a minibuffer
*Minibuf-0* is a minibuffer
some minutes ago I had 5, all with just one emacs frame. And with emacs
-Q, I first have one and after the first window split, I have 2.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: when deleting in minibuffer, don't change kill-ring
2011-10-27 18:23 ` Tassilo Horn
@ 2011-10-27 18:38 ` Peter Dyballa
2011-10-27 19:08 ` Tassilo Horn
2011-10-27 21:53 ` Drew Adams
1 sibling, 1 reply; 8+ messages in thread
From: Peter Dyballa @ 2011-10-27 18:38 UTC (permalink / raw
To: Tassilo Horn; +Cc: help-gnu-emacs
Am 27.10.2011 um 20:23 schrieb Tassilo Horn:
> Another observation: why are there more than one minibuffers? Right
> now, I have 4:
>
> (dolist (b (buffer-list))
> (when (minibufferp b)
> (insert (format "%s is a minibuffer\n" b)))) ;; C-j
> *Minibuf-1* is a minibuffer
> *Minibuf-2* is a minibuffer
> *Minibuf-3* is a minibuffer
> *Minibuf-0* is a minibuffer
Are you working on a "HDBox"? (A set-top box for digital TV reception and HD recording.) It tries to record marked TV broadcasts many times – and fails because of this!
--
Mit friedvollen Grüßen
<]
Pete o __o |__ o recumbo
___o /I -\<, |o \ -\),-% ergo sum!
___/\ /\___./ \___...O/ O____.....`-O-'-()--o_________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: when deleting in minibuffer, don't change kill-ring
2011-10-27 18:38 ` Peter Dyballa
@ 2011-10-27 19:08 ` Tassilo Horn
0 siblings, 0 replies; 8+ messages in thread
From: Tassilo Horn @ 2011-10-27 19:08 UTC (permalink / raw
To: Peter Dyballa; +Cc: help-gnu-emacs
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
>> Another observation: why are there more than one minibuffers? Right
>> now, I have 4:
>>
>> (dolist (b (buffer-list))
>> (when (minibufferp b)
>> (insert (format "%s is a minibuffer\n" b)))) ;; C-j
>> *Minibuf-1* is a minibuffer
>> *Minibuf-2* is a minibuffer
>> *Minibuf-3* is a minibuffer
>> *Minibuf-0* is a minibuffer
>
> Are you working on a "HDBox"? (A set-top box for digital TV reception
> and HD recording.) It tries to record marked TV broadcasts many times
> – and fails because of this!
Err, I don't get you. In case it's not a joke that I don't get, no,
it's a standard GNU/Linux notebook.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: when deleting in minibuffer, don't change kill-ring
2011-10-27 18:23 ` Tassilo Horn
2011-10-27 18:38 ` Peter Dyballa
@ 2011-10-27 21:53 ` Drew Adams
2011-10-28 6:53 ` Tassilo Horn
1 sibling, 1 reply; 8+ messages in thread
From: Drew Adams @ 2011-10-27 21:53 UTC (permalink / raw
To: 'Tassilo Horn', help-gnu-emacs
> I 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 commands
to:
(defun delete-word (arg)
(interactive "p")
(delete-region (point) (progn (forward-word arg) (point))))
(defun backward-delete-word (arg)
(interactive "p")
(delete-word (- arg)))
Then, as I said, bind these in _each_ of the minibuffer keymaps. This is for
one of the maps:
(define-key minibuffer-local-must-match-map
[remap kill-word] 'delete-word)
(define-key minibuffer-local-must-match-map
[remap backward-kill-word] 'backward-delete-word)
> What 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)))
> Isn't it possible to have buffer local values for
> variables defined at the C level?
Yes, AFAIK.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: when deleting in minibuffer, don't change kill-ring
2011-10-27 21:53 ` Drew Adams
@ 2011-10-28 6:53 ` Tassilo Horn
2011-10-28 7:10 ` Tassilo Horn
0 siblings, 1 reply; 8+ messages in thread
From: Tassilo Horn @ 2011-10-28 6:53 UTC (permalink / raw
To: Drew Adams; +Cc: help-gnu-emacs
"Drew Adams" <drew.adams@oracle.com> writes:
>> I 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
> commands to:
Yes, that would be a possibility.
>> What 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: when deleting in minibuffer, don't change kill-ring
2011-10-28 6:53 ` Tassilo Horn
@ 2011-10-28 7:10 ` Tassilo Horn
0 siblings, 0 replies; 8+ messages in thread
From: Tassilo Horn @ 2011-10-28 7:10 UTC (permalink / raw
To: help-gnu-emacs
Tassilo Horn <tassilo@member.fsf.org> writes:
> Using this advice, I think I finally got the intended behavior:
>
> (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)))))
>
> 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.
Argh, this somehow has the weird side effect of disturbing font-lock
somehow. For example, after starting emacs with the advice above, the
comment in *scratch* is not highlighted, and the same applies to latex
buffers. Elisp buffers are highlighted, though...
Bye,
Tassilo
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-10-28 7:10 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-27 16:35 when deleting in minibuffer, don't change kill-ring filebat Mark
2011-10-27 16:52 ` Drew Adams
2011-10-27 18:23 ` Tassilo Horn
2011-10-27 18:38 ` Peter Dyballa
2011-10-27 19:08 ` Tassilo Horn
2011-10-27 21:53 ` Drew Adams
2011-10-28 6:53 ` Tassilo Horn
2011-10-28 7:10 ` Tassilo Horn
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.