From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#9406: 24.0.50; Use M-p/M-n to navigate through the kill ring Date: Thu, 01 Sep 2011 20:39:20 -0400 Message-ID: References: <87zkirnlug.fsf@mail.jurta.org> <87ippfnl3g.fsf@mail.jurta.org> <4E5E3D6A.3050504@dogan.se> <87zkiphcqw.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1314924032 25002 80.91.229.12 (2 Sep 2011 00:40:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 2 Sep 2011 00:40:32 +0000 (UTC) Cc: Thierry Volpiatto To: 9406@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 02 02:40:26 2011 Return-path: Envelope-to: geb-bug-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 1QzHo1-0003F4-EI for geb-bug-gnu-emacs@m.gmane.org; Fri, 02 Sep 2011 02:40:25 +0200 Original-Received: from localhost ([::1]:46044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzHo0-0003tb-KN for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Sep 2011 20:40:24 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:60319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzHnK-0001T1-8l for bug-gnu-emacs@gnu.org; Thu, 01 Sep 2011 20:39:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QzHnI-0000p6-UU for bug-gnu-emacs@gnu.org; Thu, 01 Sep 2011 20:39:42 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56666) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzHnI-0000p1-O4 for bug-gnu-emacs@gnu.org; Thu, 01 Sep 2011 20:39:40 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QzHqX-000185-T0; Thu, 01 Sep 2011 20:43:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Sep 2011 00:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9406 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9406-submit@debbugs.gnu.org id=B9406.13149241674321 (code B ref 9406); Fri, 02 Sep 2011 00:43:01 +0000 Original-Received: (at 9406) by debbugs.gnu.org; 2 Sep 2011 00:42:47 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QzHqJ-00017e-Be for submit@debbugs.gnu.org; Thu, 01 Sep 2011 20:42:47 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QzHqF-00017V-I2 for 9406@debbugs.gnu.org; Thu, 01 Sep 2011 20:42:44 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AosWAD8lYE64rwMJ/2dsb2JhbABCgjGCHJRfjyZ4gUABAQQBIzMjBQsJAhoCGA4CAhQYDYgpqHuSAYEshCKBEQSgD4RA X-IronPort-AV: E=Sophos;i="4.68,316,1312171200"; d="scan'208";a="133995850" Original-Received: from 184-175-3-9.dsl.teksavvy.com (HELO ceviche.home) ([184.175.3.9]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 01 Sep 2011 20:39:21 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id AD9E3660B6; Thu, 1 Sep 2011 20:39:20 -0400 (EDT) In-Reply-To: <87zkiphcqw.fsf@gmail.com> (Thierry Volpiatto's message of "Wed, 31 Aug 2011 16:33:27 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 01 Sep 2011 20:43:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:50534 Archived-At: >> Why "free" the M-y binding if it means jailing M-n and M-p? You didn't read me right: I only pointed out that *if/when* M-p/M-n is used as suggested, then M-y can be freed. >> M-y does nothing useful unless preceded by C-y today, so in that >> sense it's already "free". That's true, except that the current implementation occupies the M-y binding all the time. > It's so convenient to have a kill-ring browser, i don't understand why > Emacs have not one and continue cycling blindly to find something in > kill-ring... It's already been suggested, and I agree it's a good idea. I.e. patches welcome for Emacs-24.2. But most likely I'd only accept such a patch if the "kill-ring browser" uses a more-or-less standard "minibuffer with completion". OTOH it'd be OK for that patch to include some changes to minibuffer.el, if needed. FWIW, here's the code I'm using right now. Stefan (defun yank-browse (string) "Browse the `kill-ring' to choose which entry to yank." (interactive (minibuffer-with-setup-hook #'minibuffer-completion-help (let* ((kills (delete-dups (append kill-ring-yank-pointer kill-ring ni= l))) (entries (mapcar (lambda (string) (let ((pos 0)) ;; FIXME: Maybe we should start by removing ;; all properties. (setq string (copy-sequence string)) (while (string-match "\n" string pos) ;; FIXME: Maybe completion--insert-strings should ;; do that for us. (put-text-property (match-beginning 0) (match-end 0) 'display (eval-when-compile (propertize "\\n" 'face 'escape-glyp= h)) string) (setq pos (match-end 0))) ;; FIXME: We may use the window-width of the ;; wrong window. (when (>=3D (* 3 (string-width string)) (* 2 (window-width))) (let ((half (- (/ (window-width) 3) 1))) ;; FIXME: We're using char-counts rather than ;; width-count. (put-text-property half (- (length string) half) 'display (eval-when-compile (propertize "=E2=80=A6=E2=80=A6" '= face 'escape-glyph)) string))) string)) kills)) (table (lambda (string pred action) (cond ((eq action 'metadata) '(metadata (category . kill-ring))) (t (complete-with-action action entries string pred))))= )) ;; FIXME: We should return the entry from the kill-ring rather than ;; the entry from the completion-table. ;; FIXME: substring completion doesn't work well because it only mat= ches ;; subtrings before the first \n. ;; FIXME: completion--insert-strings assumes that boundaries of ;; candidates are obvious enough, but with kill-ring entries this is= not ;; true, so we'd probably want to display them with =C2=AB...=C2=BB = around them. (list (completing-read "Yank: " table nil t))))) (setq this-command 'yank) (insert-for-yank string))