From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: rusi Newsgroups: gmane.emacs.help Subject: Re: Passing current buffer to compile command Date: Sun, 16 Jan 2011 19:29:50 -0800 (PST) Organization: http://groups.google.com Message-ID: <113f82c8-b020-4405-b0b3-6f77df748f4b@l17g2000yqe.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1295235632 10420 80.91.229.12 (17 Jan 2011 03:40:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 17 Jan 2011 03:40:32 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 17 04:40:28 2011 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.69) (envelope-from ) id 1PefxE-0002a7-Jn for geh-help-gnu-emacs@m.gmane.org; Mon, 17 Jan 2011 04:40:28 +0100 Original-Received: from localhost ([127.0.0.1]:44787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PefxD-0008MP-TY for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Jan 2011 22:40:27 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!l17g2000yqe.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 18 Original-NNTP-Posting-Host: 116.73.35.230 Original-X-Trace: posting.google.com 1295234990 6758 127.0.0.1 (17 Jan 2011 03:29:50 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 17 Jan 2011 03:29:50 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l17g2000yqe.googlegroups.com; posting-host=116.73.35.230; posting-account=mBpa7woAAAAGLEWUUKpmbxm-Quu5D8ui User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13,gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:184331 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:78502 Archived-At: On Jan 17, 12:12=A0am, duke wrote: > How do I do that? I'm not using make, but another compiler. So I need > to pass a filename. Instead of inputing the filename, how do I pass > the current buffer file name? %f ? > -- > duke In vi '%' at the colon prompt gives the file name. (Like your %f) The following will give that to you in the minibuffer [But beware of using it with buffers that have no file associated) (define-key minibuffer-local-map "%" (function (lambda () (interactive) (insert (file-name-nondirectory (buffer-file-name (window-buffer (minibuffer-selected-window))))))))