From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Re: yank-match.el -- yank matches for a regexp from kill-ring Date: Sun, 02 Mar 2008 18:50:01 -0500 Message-ID: <87tzjowus6.fsf@red-bean.com> References: <87bqedqltf.fsf@red-bean.com> <873ar9xfps.fsf@red-bean.com> <87zlthatxy.fsf@jurta.org> Reply-To: Karl Fogel NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1204501814 21925 80.91.229.12 (2 Mar 2008 23:50:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Mar 2008 23:50:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 03 00:50:41 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JVxx2-0007l5-Gh for ged-emacs-devel@m.gmane.org; Mon, 03 Mar 2008 00:50:40 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JVxwV-0007D0-PJ for ged-emacs-devel@m.gmane.org; Sun, 02 Mar 2008 18:50:07 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JVxwS-0007Cs-3v for emacs-devel@gnu.org; Sun, 02 Mar 2008 18:50:04 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JVxwR-0007Cd-22 for emacs-devel@gnu.org; Sun, 02 Mar 2008 18:50:03 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JVxwQ-0007Ca-TS for emacs-devel@gnu.org; Sun, 02 Mar 2008 18:50:02 -0500 Original-Received: from sanpietro.red-bean.com ([66.146.193.61]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JVxwQ-00044n-Hz for emacs-devel@gnu.org; Sun, 02 Mar 2008 18:50:02 -0500 Original-Received: from localhost ([127.0.0.1]:44559 ident=kfogel) by sanpietro.red-bean.com with esmtp (Exim 4.68) (envelope-from ) id 1JVxwP-0008TE-BY; Sun, 02 Mar 2008 17:50:01 -0600 In-Reply-To: <87zlthatxy.fsf@jurta.org> (Juri Linkov's message of "Sun\, 02 Mar 2008 19\:59\:05 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:91121 Archived-At: Juri Linkov writes: > May I make some remarks? Usually a good function is harder to find > in a separate small file. Also it is more difficult to incorporate a > separate file into the core functionality. But this would be useful: > when I tried using your `yank-match' at the first try it yanked the > first match but I needed one of the next matches. Then I typed M-y > to cycle next matches, but this method failed. I think just like a > sequence of `C-y M-y M-y M-y' cycles the kill-ring it would be good to > do the same for `yank-match' as `M-x yank-match RET regexp RET M-y M-y' > to cycle matches from the kill-ring. Thank you, this is a good idea. Repeated invocations of `yank-match' will have this effect. It never occurred to me to make M-y DTRT, but it seems obvious in retrospect: M-y (that is, `yank-pop') should cycle through the kill-ring in the usual way if the initial command was `yank', but cycle matches if the initial command was `yank-match'. > BTW, I have a command for similar purposes: > > (defun insert-yank-from-kill-ring (string) > "Insert the selected item from the kill-ring in the minibuffer history. > Use minibuffer navigation and search commands to browse the kill-ring > in the minibuffer history." > (interactive (list (read-string "Yank from kill-ring: " nil 'kill-ring))) > (insert-for-yank string)) > > Comparing to your approach, it has one drawback: multi-line elements > in the kill-ring will resize the minibuffer, but in other respects > those are complementing approaches. Yes, that seems useful -- but big matches have a problem, as you pointed out. Also, sometimes one just knows the right regexp (usually just a substring), in which case `yank-match' is the fastest way to get there. Stefan Monnier writes: > Your file uses ";;;" incorrectly. Most of those should be ";;" (the > ";;;" should be used to separate sections). *nod* Can fix. > But in any case, there's no need for a separate file for such > a small function. Okay. Shall I make the changes Juri suggests above re M-y, and put both the `yank-match' code and his code above into simple.el? -Karl