From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: when deleting in minibuffer, don't change kill-ring Date: Fri, 28 Oct 2011 08:53:04 +0200 Message-ID: <877h3pli9b.fsf@thinkpad.tsdh.de> References: <7AF781F7ABA44DA5A698D5AFA772C4B2@us.oracle.com> <87pqhiuwcy.fsf@thinkpad.tsdh.de> <2E5FB92AF4854B6CB7774F5D671C3320@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1319784806 23723 80.91.229.12 (28 Oct 2011 06:53:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 28 Oct 2011 06:53:26 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Drew Adams" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 28 08:53:21 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RJgJd-0005Ng-ER for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Oct 2011 08:53:21 +0200 Original-Received: from localhost ([::1]:43571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJgJc-0008Ow-Vk for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Oct 2011 02:53:20 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:50095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJgJW-0008Od-Ms for help-gnu-emacs@gnu.org; Fri, 28 Oct 2011 02:53:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RJgJV-0007Wt-LP for help-gnu-emacs@gnu.org; Fri, 28 Oct 2011 02:53:14 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:41417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJgJV-0007Wo-Bu for help-gnu-emacs@gnu.org; Fri, 28 Oct 2011 02:53:13 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id B2E60D2235; Fri, 28 Oct 2011 08:53:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at uni-koblenz.de Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q6+BtBfLH-iA; Fri, 28 Oct 2011 08:53:11 +0200 (CEST) X-CHKRCPT: Envelopesender noch tassilo@member.fsf.org Original-Received: from thinkpad.tsdh.de (tsdh.uni-koblenz.de [141.26.67.142]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 352A5D2231; Fri, 28 Oct 2011 08:53:11 +0200 (CEST) In-Reply-To: <2E5FB92AF4854B6CB7774F5D671C3320@us.oracle.com> (Drew Adams's message of "Thu, 27 Oct 2011 14:53:31 -0700") User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 141.26.64.15 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82684 Archived-At: "Drew Adams" writes: >> I guess the OP means `backward-kill-word' () 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