all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
To: 15631@debbugs.gnu.org
Subject: bug#15631: 24.3; ido : invert effect of ido-restrict-to-matches with prefix arg
Date: Wed, 16 Oct 2013 16:54:24 +0200	[thread overview]
Message-ID: <87r4bl4673.fsf@yahoo.fr> (raw)

Hello

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) :

diff --git a/lisp/ido.el b/lisp/ido.el
index cda4021..31aa303 100644
*** a/lisp/ido.el
--- b/lisp/ido.el
***************
*** 3133,3143 ****
        (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)
    (when ido-matches
!     (setq ido-cur-list ido-matches
  	  ido-text-init ""
  	  ido-rescan nil
  	  ido-exit 'keep)
--- 3133,3155 ----
        (if (> i 0)
  	  (setq ido-cur-list (ido-chop ido-cur-list (nth i ido-matches)))))))
  
! (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 (cond
!                         (removep
!                          (delq nil
!                                (mapcar
!                                 (lambda (elt)
!                                   (when (not (member elt ido-matches))
!                                     elt))
!                                 ido-cur-list)))
!                         (t ido-matches))
!           ido-matches ido-cur-list
  	  ido-text-init ""
  	  ido-rescan nil
  	  ido-exit 'keep)

-- 
Nicolas.





             reply	other threads:[~2013-10-16 14:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-16 14:54 Nicolas Richard [this message]
2015-06-30 15:28 ` bug#15631: 24.3; ido : invert effect of ido-restrict-to-matches with prefix arg Nicolas Richard
2015-06-30 16:17   ` Eli Zaretskii
2015-07-01 23:01     ` Nicolas Richard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r4bl4673.fsf@yahoo.fr \
    --to=theonewiththeevillook@yahoo.fr \
    --cc=15631@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.