[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic completion-ignored-extensions

From: Kevin Rodgers
Subject: Re: dynamic completion-ignored-extensions
Date: Sun, 20 Jul 2008 08:53:27 -0600
User-agent: Thunderbird (Macintosh/20080421)

Kevin Ryde wrote:
Is there a way to have a kind of dynamic completion-ignored-extensions
so that for instance a .c file is ignored if there's a .xs of the same
name?  Or even a kind of programmatic ignore so Makefile is not offered
if it seems to be in a build directory of some flavour (and therefore a
generated file).

I tried sticking a defadvice on file-name-completion, but in emacs22 it
doesn't seem to be reached.  I guess read-file-name is C code and
bypasses advice, or something.  Is there another filename reader that
could be could be easily pressed into service and customized?

Right, and read-file-name is implemented in C as well, which is why
there is the read-file-name-function variable (C-h v).  Maybe something
like this will do what you want:

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

(setq read-file-name-function 'my-read-file-name)

Kevin Rodgers
Denver, Colorado, USA

reply via email to

[Prev in Thread] Current Thread [Next in Thread]