From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.devel Subject: Re: M-y in isearch mode Date: Tue, 03 May 2011 00:51:28 +0800 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1304355109 4272 80.91.229.12 (2 May 2011 16:51:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 2 May 2011 16:51:49 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 02 18:51:45 2011 Return-path: Envelope-to: ged-emacs-devel@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 1QGwLZ-0002rN-9q for ged-emacs-devel@m.gmane.org; Mon, 02 May 2011 18:51:45 +0200 Original-Received: from localhost ([::1]:48747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGwLY-00012C-MO for ged-emacs-devel@m.gmane.org; Mon, 02 May 2011 12:51:44 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:46650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGwLR-000123-ER for emacs-devel@gnu.org; Mon, 02 May 2011 12:51:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGwLQ-0001R8-8B for emacs-devel@gnu.org; Mon, 02 May 2011 12:51:37 -0400 Original-Received: from mail-pw0-f41.google.com ([209.85.160.41]:41118) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGwLP-0001Qf-Uu for emacs-devel@gnu.org; Mon, 02 May 2011 12:51:36 -0400 Original-Received: by pwi10 with SMTP id 10so3852252pwi.0 for ; Mon, 02 May 2011 09:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=rBLH1g6K9qVp3Q4hgUrT1T2zTjOhkMHXxThf1bsx0qU=; b=EzvFWW/6Kwi1Czst0hXSslidEKiZBOaimwYeBkjlBkzy0PzcwbMhgEKTs6KVWClMGw blqnCSlx3GDR1vQn6ERbC/PsYMYSaRN0qJaj5a93uBp39BFsQsgGrct36PsL0q5I2O0W ksVrQ6PJR8FitTZslcDw2sExTlfzY4c9yHo+8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=YbVmnDpzPqugYqWwdakezfmigxbbw1PryaASk9kUQ3UDbCzGeu158KnzGO4dfwSIfR uS2re0Af2wry1CxtuaCKNGmkrFhSg+XxpH9tyOCKK1rsjFmQNIjdy+3oQuwZGyLv1AKx SM5l6Emihk3mc4dudDcsb9ITo/Qp7OD9Ny9Fs= Original-Received: by 10.68.10.105 with SMTP id h9mr9320994pbb.108.1304355094530; Mon, 02 May 2011 09:51:34 -0700 (PDT) Original-Received: from th041070.ip.tsinghua.edu.cn (th041117.ip.tsinghua.edu.cn [59.66.41.117]) by mx.google.com with ESMTPS id i10sm3918698pbd.28.2011.05.02.09.51.31 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 02 May 2011 09:51:33 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Mon, 02 May 2011 13:27:55 -0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3.50 (Mac OS X 10.6.7) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.160.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138966 Archived-At: On 2011-05-03 00:27 +0800, Stefan Monnier wrote: > Now that C-y is bound to isearch-yank-kill, it would indeed make sense > for M-y to match the behavior of M-y outside isearch. > > But maybe for compatibility with old "finger memory", we should allow > a M-y that does not follow isearch-yank-kill isearch-yank-pop. > I.e. rather than signal a "previous isearch command was not a yank", we > should simply turn it into an isearch-yank-kill. > WDYT? Sounds good. Patch modified to this suggestion. diff --git a/lisp/isearch.el b/lisp/isearch.el index e59fb29a..04d41af2 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -472,7 +472,7 @@ (defvar isearch-mode-map (define-key map "\M-n" 'isearch-ring-advance) (define-key map "\M-p" 'isearch-ring-retreat) - (define-key map "\M-y" 'isearch-yank-kill) + (define-key map "\M-y" 'isearch-yank-pop) (define-key map "\M-\t" 'isearch-complete) @@ -636,6 +636,8 @@ (defun isearch-forward (&optional regexp-p no-recursive-edit) Type \\[isearch-yank-line] to yank rest of line onto end of search string\ and search for it. Type \\[isearch-yank-kill] to yank the last string of killed text. +Type \\[isearch-yank-pop] to replace string just yanked into search prompt + with string killed before it. Type \\[isearch-quote-char] to quote control character to search for it. \\[isearch-abort] while searching or when search has failed cancels input\ back to what has @@ -1499,6 +1501,14 @@ (defun isearch-yank-kill () (interactive) (isearch-yank-string (current-kill 0))) +(defun isearch-yank-pop () + "Replace just-yanked search string with previously killed string." + (interactive) + (if (not (memq last-command '(isearch-yank-kill isearch-yank-pop))) + (isearch-yank-kill) + (isearch-pop-state) + (isearch-yank-string (current-kill 1)))) + (defun isearch-yank-x-selection () "Pull current X selection into search string." (interactive)