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

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

RE: when deleting in minibuffer, don't change kill-ring


From: Drew Adams
Subject: RE: when deleting in minibuffer, don't change kill-ring
Date: Thu, 27 Oct 2011 14:53:31 -0700

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




reply via email to

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