From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: kill-ring visualization Date: Thu, 25 Mar 2010 19:29:57 +0200 Organization: JURTA Message-ID: <87aatwv12t.fsf@mail.jurta.org> References: <87y6hib6vi.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1269548441 28137 80.91.229.12 (25 Mar 2010 20:20:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 25 Mar 2010 20:20:41 +0000 (UTC) Cc: Emacs development discussions To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 25 21:20:36 2010 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.69) (envelope-from ) id 1NutXf-0008Cl-RU for ged-emacs-devel@m.gmane.org; Thu, 25 Mar 2010 21:20:36 +0100 Original-Received: from localhost ([127.0.0.1]:53306 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nut3j-0002af-QC for ged-emacs-devel@m.gmane.org; Thu, 25 Mar 2010 15:49:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NuqyA-0002Of-TP for emacs-devel@gnu.org; Thu, 25 Mar 2010 13:35:46 -0400 Original-Received: from [140.186.70.92] (port=41967 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nuqy7-0002Lk-PU for emacs-devel@gnu.org; Thu, 25 Mar 2010 13:35:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nuqy2-0003ca-LN for emacs-devel@gnu.org; Thu, 25 Mar 2010 13:35:41 -0400 Original-Received: from smtp-out1.starman.ee ([85.253.0.3]:50571 helo=mx1.starman.ee) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nuqy2-0003cM-EE for emacs-devel@gnu.org; Thu, 25 Mar 2010 13:35:38 -0400 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (82.131.30.101.cable.starman.ee [82.131.30.101]) by mx1.starman.ee (Postfix) with ESMTP id 598563F40CB; Thu, 25 Mar 2010 19:35:31 +0200 (EET) In-Reply-To: (Stefan Monnier's message of "Wed, 24 Mar 2010 09:54:58 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:122670 Archived-At: > If you use a `substring' style completion, you're already closer (tho > it's not a regexp-search). Is the below what you mean? I remember there were requests to reuse M-y to complete on the kill-ring instead of signalling an error that the previous command was not a yank. === modified file 'lisp/simple.el' --- lisp/simple.el 2010-03-23 23:25:12 +0000 +++ lisp/simple.el 2010-03-25 17:29:27 +0000 @@ -3216,9 +3216,21 @@ (defun yank-pop (&optional arg) When this command inserts killed text into the buffer, it honors `yank-excluded-properties' and `yank-handler' as described in the doc string for `insert-for-yank-1', which see." - (interactive "*p") + (interactive + (list + (if (not (eq last-command 'yank)) + (let ((completion-styles '(substring))) + (completing-read "Yank from kill-ring: " kill-ring)) + (barf-if-buffer-read-only) + current-prefix-arg))) + (if (not (eq last-command 'yank)) - (error "Previous command was not a yank")) + (yank (mod (abs (- (length (member arg kill-ring)) + (length kill-ring-yank-pointer) + 1)) + (length kill-ring))) + + ;; Otherwise, if last-command eq 'yank. (setq this-command 'yank) (unless arg (setq arg 1)) (let ((inhibit-read-only t) @@ -3238,7 +3250,8 @@ (defun yank-pop (&optional arg) ;; loop would deactivate the mark because we inserted text. (goto-char (prog1 (mark t) (set-marker (mark-marker) (point) (current-buffer)))))) - nil) + nil)) + (defun yank (&optional arg) "Reinsert (\"paste\") the last stretch of killed text. PS: This patch is for the demonstration, not for installation. -- Juri Linkov http://www.jurta.org/emacs/