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: Wed, 31 Aug 2011 09:01:04 -0400 Message-ID: References: <87zkirnlug.fsf@mail.jurta.org> <87ippfnl3g.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1314795725 9477 80.91.229.12 (31 Aug 2011 13:02:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 31 Aug 2011 13:02:05 +0000 (UTC) Cc: 9406@debbugs.gnu.org To: Dani Moncayo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 31 15:02:01 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 1QykQZ-00016I-Rl for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Aug 2011 15:01:59 +0200 Original-Received: from localhost ([::1]:49663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QykQY-0007vj-Oq for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Aug 2011 09:01:58 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:53870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QykQR-0007rJ-Jv for bug-gnu-emacs@gnu.org; Wed, 31 Aug 2011 09:01:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QykQQ-0004nm-9T for bug-gnu-emacs@gnu.org; Wed, 31 Aug 2011 09:01:51 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34181) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QykQQ-0004na-7l for bug-gnu-emacs@gnu.org; Wed, 31 Aug 2011 09:01:50 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QykTW-0008M0-PV; Wed, 31 Aug 2011 09:05:02 -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: Wed, 31 Aug 2011 13:05:02 +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.131479586232059 (code B ref 9406); Wed, 31 Aug 2011 13:05:02 +0000 Original-Received: (at 9406) by debbugs.gnu.org; 31 Aug 2011 13:04:22 +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 1QykSs-0008L0-0D for submit@debbugs.gnu.org; Wed, 31 Aug 2011 09:04:22 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QykSo-0008Kq-4E for 9406@debbugs.gnu.org; Wed, 31 Aug 2011 09:04:20 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuQSAKwvXk64rwMJ/2dsb2JhbABDgjGmFniBQAEBBAFWFQ4FCwsOJhIUGA0kiAWpX49thlUEoAqEPg X-IronPort-AV: E=Sophos;i="4.68,307,1312171200"; d="scan'208";a="133665559" 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; 31 Aug 2011 09:01:04 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 35024660B1; Wed, 31 Aug 2011 09:01:04 -0400 (EDT) In-Reply-To: (Dani Moncayo's message of "Wed, 31 Aug 2011 08:22:20 +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: Wed, 31 Aug 2011 09:05:02 -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:50471 Archived-At: Basically it would amount to moving the M-y binding to M-p but only if used immediately after C-y, and to add a M-n binding to the same command but that cycles in the other direction. That doesn't sound like a bad idea, although of course it will annoy a few users in a few corner cases (e.g. I have M-n and M-p bound in smerge-mode). So we might prefer to have it as an option. > I'm not an expert in Emacs' internals, but I think that one way of > implementing this would be as a minor mode, that would be activated by > C-y (like Isearch is activated by C-s), and deactivated by "anything > else" (distinct from M-p M-n and M-y*). I use the function below to do these kinds of things. I didn't find the time to install it for Emacs-24.1, tho. You should be able to get this working fairly cleanly with an after-advice on `yank' which uses that set-temporary-overlay-map. > (*) The behavior of M-y would remain the same, obviously, for old-timers. Actually one of the benefits of your proposal is that it opens up the possibility of freeing the M-y binding. Stefan (defun set-temporary-overlay-map (map &optional keep-pred) (let* ((clearfunsym (make-symbol "clear-temporary-overlay-map")) (overlaysym (make-symbol "t")) (alist (list (cons overlaysym map))) (clearfun ;; FIXME: Use lexical-binding. `(lambda () (unless ,(cond ((null keep-pred) nil) ((eq t keep-pred) `(eq this-command (lookup-key ',map (this-command-keys-vector)))) (t `(funcall ',keep-pred))) (remove-hook 'pre-command-hook ',clearfunsym) (setq emulation-mode-map-alists (delq ',alist emulation-mode-map-alists)))))) (set overlaysym overlaysym) (fset clearfunsym clearfun) (add-hook 'pre-command-hook clearfunsym) ;; FIXME: That's the keymaps with highest precedence, except for ;; the `keymap' text-property ;-( (push alist emulation-mode-map-alists)))