all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Ryde <user42@zip.com.au>
To: help-gnu-emacs@gnu.org
Subject: Re: dynamic completion-ignored-extensions
Date: Thu, 24 Jul 2008 10:43:10 +1000	[thread overview]
Message-ID: <873am0nmch.fsf@blah.blah> (raw)
In-Reply-To: <g5vjh7$pqt$1@ger.gmane.org> (Kevin Rodgers's message of "Sun, 20 Jul 2008 08:53:27 -0600")

Kevin Rodgers <kevin.d.rodgers@gmail.com> 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"))))




      reply	other threads:[~2008-07-24  0:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-18  0:51 dynamic completion-ignored-extensions Kevin Ryde
2008-07-20 14:53 ` Kevin Rodgers
2008-07-24  0:43   ` Kevin Ryde [this message]

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=873am0nmch.fsf@blah.blah \
    --to=user42@zip.com.au \
    --cc=help-gnu-emacs@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.