From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Richard Newsgroups: gmane.emacs.bugs Subject: bug#15631: 24.3; ido : invert effect of ido-restrict-to-matches with prefix arg Date: Tue, 30 Jun 2015 17:28:38 +0200 Message-ID: <86pp4dcj15.fsf@members.fsf.org> References: <87r4bl4673.fsf@yahoo.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1435678163 7033 80.91.229.3 (30 Jun 2015 15:29:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 30 Jun 2015 15:29:23 +0000 (UTC) To: 15631@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 30 17:29:12 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z9xTD-0000Bf-Jj for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Jun 2015 17:29:11 +0200 Original-Received: from localhost ([::1]:47523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9xTD-0001aa-0f for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Jun 2015 11:29:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9xT8-0001a6-Mz for bug-gnu-emacs@gnu.org; Tue, 30 Jun 2015 11:29:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9xT4-0007ip-Lq for bug-gnu-emacs@gnu.org; Tue, 30 Jun 2015 11:29:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9xT4-0007il-HZ for bug-gnu-emacs@gnu.org; Tue, 30 Jun 2015 11:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z9xT4-0006N9-87 for bug-gnu-emacs@gnu.org; Tue, 30 Jun 2015 11:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas Richard Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Jun 2015 15:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15631 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 15631-submit@debbugs.gnu.org id=B15631.143567812324471 (code B ref 15631); Tue, 30 Jun 2015 15:29:02 +0000 Original-Received: (at 15631) by debbugs.gnu.org; 30 Jun 2015 15:28:43 +0000 Original-Received: from localhost ([127.0.0.1]:34619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9xSk-0006Mc-7r for submit@debbugs.gnu.org; Tue, 30 Jun 2015 11:28:42 -0400 Original-Received: from mxin.ulb.ac.be ([164.15.128.112]:61990) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9xSi-0006MP-2o for 15631@debbugs.gnu.org; Tue, 30 Jun 2015 11:28:41 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuMEAK60klWkD4XH/2dsb2JhbABbhESrGgEBAQEBBpoFAoIZAQEBAQEBgQuEIgEBAQSBCQgDEQMBAgolDwEEOyEaAYd/AxLHfgEBAQcBAQEBHoYchS6CTYIoGBaEFQEEhVoKizKCcYczgkeDF4ZugR+HXIM9g10mgj2BPzwxgkgBAQE Original-Received: from pno-math-199.ulb.ac.be (HELO Aurora) ([164.15.133.199]) by smtp.ulb.ac.be with ESMTP; 30 Jun 2015 17:28:39 +0200 In-Reply-To: <87r4bl4673.fsf@yahoo.fr> (Nicolas Richard's message of "Wed, 16 Oct 2013 16:54:24 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:104535 Archived-At: --=-=-= Content-Type: text/plain Nicolas Richard writes: > The function `ido-restrict-to-matches' is used within ido to restrict > focus on currently matched items. It was asked on #emacs to have a > function with the opposite effect : restrict focus on unmatched items. > > I found it was useful for me and came up with this solution (adding an > optional argument to the existing function) : I modified the patch a tiny bit and now use the new library seq.el and add a NEWS entry. If nobody complains I'll install this patch in the next few days. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Add-argument-to-reverse-the-meaning-of-ido-restrict-.patch >From c8469c5892c7d01045f81a99a7535b3ed76abd2d Mon Sep 17 00:00:00 2001 From: Nicolas Richard Date: Tue, 30 Jun 2015 09:18:27 +0200 Subject: [PATCH] Add argument to reverse the meaning of ido-restrict-to-matches * lisp/ido.el (ido-restrict-to-matches): Add an optional argument to reverse the meaning. ; * etc/NEWS: Mention the change --- etc/NEWS | 3 +++ lisp/ido.el | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 1f8cbbc..8ee8364 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -398,6 +398,9 @@ If you need your objects to be named, do it by inheriting from `eieio-named'. *** New command `ido-bury-buffer-at-head' bound to C-S-b Bury the buffer at the head of `ido-matches', analogous to how C-k kills the buffer at head. +*** A prefix argument to `ido-restrict-to-matches' will reverse its +meaning, and the list is restricted those elements that do not match +the current input. ** Minibuffer diff --git a/lisp/ido.el b/lisp/ido.el index 5995fcd..1f12fbf 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -322,6 +322,7 @@ ;;; Code: (defvar recentf-list) +(require 'seq) ;;;; Options @@ -3180,11 +3181,19 @@ for first matching file." (if (> i 0) (setq ido-cur-list (ido-chop ido-cur-list (nth i ido-matches))))))) -(defun ido-restrict-to-matches () - "Set current item list to the currently matched items." - (interactive) +(defun ido-restrict-to-matches (&optional removep) + "Set current item list to the currently matched items. + +When argument REMOVEP is non-nil, the currently matched items are +instead removed from the current item list." + (interactive "P") (when ido-matches - (setq ido-cur-list ido-matches + (setq ido-cur-list (if removep + ;; An important feature is to preserve the + ;; order of the elements. + (seq-difference ido-cur-list ido-matches) + ido-matches) + ido-matches ido-cur-list ido-text-init "" ido-rescan nil ido-exit 'keep) -- 2.4.5 --=-=-= Content-Type: text/plain -- Nico. --=-=-=--