all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Getting the TAB key for filename completion
Date: Tue, 19 Aug 2008 23:21:43 -0600	[thread overview]
Message-ID: <g8g9l1$5o5$1@ger.gmane.org> (raw)
In-Reply-To: <dfc22306-0909-4748-a8f1-898c233d6f22@o40g2000prn.googlegroups.com>

Davin Pearson wrote:
> I have installed hippie-expand inside my Emacs.  Specifically I have
> installed the following command:
> 
> (fset 'my-complete-file (make-hippie-expand-function
>                          '(try-complete-file-name-partially
>                            try-complete-file-name)))
> 
> 
> 
> My trouble is that I cannot bind this command to the TAB key when you
> enter the command M-x compile RET.  Could someone please advise me how
> to get file name completion with the TAB key online?

`M-x compile' reads its COMMAND argument by calling read-from-minibuffer
with a nil KEYMAP argument, which defaults to minibuffer-local-map:

(define-key minibuffer-local-map "\t" 'my-complete-file); or (kbd "TAB")

The tricky part would be trying to restrict that binding to `M-x compile'.
I think it'd be easier to define a new command:

(defun my-compile ()
   "Run `\\[compile]' with TAB temporarily bound to `my-complete-file'."
   (interactive)
   (let ((tab-command (lookup-key minibuffer-local-map "\t")))
     (define-key minibuffer-local-map "\t" 'my-complete-file)
     (unwind-protect
	(call-interactively 'compile)
       (define-key minibuffer-local-map "\t" tab-command))))

-- 
Kevin Rodgers
Denver, Colorado, USA





  reply	other threads:[~2008-08-20  5:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-19  0:07 Getting the TAB key for filename completion Davin Pearson
2008-08-20  5:21 ` Kevin Rodgers [this message]
     [not found] ` <mailman.17097.1219209711.18990.help-gnu-emacs@gnu.org>
2008-08-20  8:24   ` Davin Pearson
2008-08-20 11:03     ` Peter Dyballa
2008-08-20 11:40       ` Nikolaj Schumacher
2008-08-21  1:34         ` Davin Pearson
     [not found]         ` <mailman.17201.1219282492.18990.help-gnu-emacs@gnu.org>
2008-08-21  5:33           ` Andreas Politz

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='g8g9l1$5o5$1@ger.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --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.