From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.help Subject: Re: dynamic completion-ignored-extensions Date: Thu, 24 Jul 2008 10:43:10 +1000 Organization: Bah Humbug Message-ID: <873am0nmch.fsf@blah.blah> References: <873am8m2tu.fsf@blah.blah> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1216860228 20241 80.91.229.12 (24 Jul 2008 00:43:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Jul 2008 00:43:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 24 02:44:37 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KLowd-0006Zz-Cv for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Jul 2008 02:44:35 +0200 Original-Received: from localhost ([127.0.0.1]:49892 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KLovk-0008Nw-0D for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Jul 2008 20:43:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KLovR-0008NY-JS for help-gnu-emacs@gnu.org; Wed, 23 Jul 2008 20:43:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KLovQ-0008Mu-5n for help-gnu-emacs@gnu.org; Wed, 23 Jul 2008 20:43:21 -0400 Original-Received: from [199.232.76.173] (port=50863 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KLovP-0008Mm-TP for help-gnu-emacs@gnu.org; Wed, 23 Jul 2008 20:43:19 -0400 Original-Received: from mailout1-13.pacific.net.au ([125.255.80.132]:58307 helo=mailout1.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KLovP-0004kv-Ff for help-gnu-emacs@gnu.org; Wed, 23 Jul 2008 20:43:19 -0400 Original-Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout1.pacific.net.au (Postfix) with ESMTP id 955953AB396 for ; Thu, 24 Jul 2008 10:43:15 +1000 (EST) Original-Received: from blah.blah (ppp21D6.dyn.pacific.net.au [61.8.33.214]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id EBF2F27414 for ; Thu, 24 Jul 2008 10:43:14 +1000 (EST) Original-Received: from gg by blah.blah with local (Exim 4.69) (envelope-from ) id 1KLovG-0001O0-SA for help-gnu-emacs@gnu.org; Thu, 24 Jul 2008 10:43:10 +1000 In-Reply-To: (Kevin Rodgers's message of "Sun, 20 Jul 2008 08:53:27 -0600") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.2 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:55875 Archived-At: Kevin Rodgers writes: > > (defun my-read-file-name (&rest args) > "Tweak `completion-ignored-extensions' before calling `read-file-name'." > (let ((read-file-name-function nil) > (completion-ignored-extensions (your-code-here))) > (apply 'read-file-name args))) Yes, close, though I had the idea of ignores depending on the name entered so-far too. I get some joy from munging deeper down like below. I guess there's 3 or 4 other completion funcs too, but tab's the only one I normally press. (I wouldn't be surprised if there was a cleaner way too ...) (defadvice minibuffer-complete (around my-ignore activate) (if minibuffer-completing-file-name (let ((completion-ignored-extensions completion-ignored-extensions)) (my-dynamic-ignored) ad-do-it) ad-do-it)) (defun my-dynamic-ignored () (let* ((contents (minibuffer-contents-no-properties)) (dir (file-name-directory contents))) (if (file-expand-wildcards (concat contents "*.xs")) (add-to-list 'completion-ignored-extensions ".c")) (if (or (file-exists-p (concat dir "Makefile.am")) (file-exists-p (concat dir "Makefile.PL"))) (add-to-list 'completion-ignored-extensions "Makefile")) (if (file-exists-p (concat dir "Build.PL")) (add-to-list 'completion-ignored-extensions "Build"))))