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: Mon, 17 Jan 2011 19:42:42 -0800 (PST) Organization: http://groups.google.com Message-ID: <2e2c80ba-11a3-4aad-ab9e-b7d14ba933af@r16g2000prh.googlegroups.com> References: <113f82c8-b020-4405-b0b3-6f77df748f4b@l17g2000yqe.googlegroups.com> <137ea07d-a5be-4b76-8a99-0b44c3977f16@g26g2000vbz.googlegroups.com> 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 1295325667 30614 80.91.229.12 (18 Jan 2011 04:41:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 18 Jan 2011 04:41:07 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 18 05:41:03 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 1Pf3NO-0007fY-I2 for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Jan 2011 05:41:02 +0100 Original-Received: from localhost ([127.0.0.1]:35773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pf3NN-00088S-R7 for geh-help-gnu-emacs@m.gmane.org; Mon, 17 Jan 2011 23:41:01 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!r16g2000prh.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-NNTP-Posting-Host: 116.73.35.230 Original-X-Trace: posting.google.com 1295322163 8332 127.0.0.1 (18 Jan 2011 03:42:43 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 18 Jan 2011 03:42:43 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r16g2000prh.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:184350 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:78521 Archived-At: On Jan 18, 12:07=A0am, duke wrote: > On Jan 16, 8:49=A0pm, rusi wrote: > > > > > On Jan 17, 8:29=A0am, rusi wrote: > > > > The following will give that to you in the minibuffer > > > [But beware of using it with buffers that have no file associated) > > > Now "No-file" should not misbehave > > > (savehist-mode 1) > > (define-key minibuffer-local-map "%" > > =A0 (function > > =A0 =A0(lambda () > > =A0 =A0 =A0(interactive) > > =A0 =A0 =A0(let ((file-path-maybe (buffer-file-name > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(window-buff= er (minibuffer-selected-window))))) > > =A0 =A0 =A0(insert (if file-path-maybe > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(file-name-nondirectory file-path-ma= ybe) > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"%")))))) > > You are too kind! Much obliged for the snippet, but especially the > courtesy. Can't wait to hack my .emacs and try it out :) I should attribute this to someone (who helped me write this) -- but cant remember who :-) More emacs-ish than vi-ish is to change the first line to (define-key minibuffer-local-map (kbd "C-f") ;; analogous to C-x C-f But then the last "%" is of course wrong and I dont know what to do with it. There should be a way of chaining back to the default binding of C-f But (lookup-key minibuffer-local-map (kbd "C-f")) is giving nil --- So dunno...