I'm not really sure what you're trying to do, but maybe this will help:
(defun foo ()
(global-set-key (kbd "<f4>") 'foo)
Use icomplete-mode - the builtin incremental minibuffer completion mode. It continuously displays a list of possible completions as soon as you type in minibuffer. Then M-x oc-m and C-j to accept completion candidate.
Yes, vanilla Emacs is weak/broken wrt option completion-ignored-extensions.
If you use Icicles there is no such problem. When a file name is ignored it is ignored completely; it is not shown in *Completions*.
And in Icicles you can toggle this ignoring off or on at any time during completion, using C-. in the minibuffer.
Icicles - File-Name ...