From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: duke Newsgroups: gmane.emacs.help Subject: Re: Passing current buffer to compile command Date: Mon, 17 Jan 2011 21:14:09 -0800 (PST) Organization: http://groups.google.com Message-ID: <5341e83b-2bd6-44eb-95a5-cd693b4cbe66@f20g2000vbc.googlegroups.com> References: <113f82c8-b020-4405-b0b3-6f77df748f4b@l17g2000yqe.googlegroups.com> <137ea07d-a5be-4b76-8a99-0b44c3977f16@g26g2000vbz.googlegroups.com> <2e2c80ba-11a3-4aad-ab9e-b7d14ba933af@r16g2000prh.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 1295329244 10389 80.91.229.12 (18 Jan 2011 05:40:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 18 Jan 2011 05:40:44 +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 06:40:40 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 1Pf4J6-0003Te-LG for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Jan 2011 06:40:40 +0100 Original-Received: from localhost ([127.0.0.1]:55343 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pf4J6-00034n-5w for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Jan 2011 00:40:40 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!f20g2000vbc.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 46 Original-NNTP-Posting-Host: 75.154.79.220 Original-X-Trace: posting.google.com 1295327649 24781 127.0.0.1 (18 Jan 2011 05:14:09 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 18 Jan 2011 05:14:09 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f20g2000vbc.googlegroups.com; posting-host=75.154.79.220; posting-account=KgDXmwoAAAC0yXS4JIhvW9CYf-pfPgw- User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20101206 SeaMonkey/2.0.11,gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:184353 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:78525 Archived-At: On Jan 17, 8:42=A0pm, rusi wrote: > 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-bu= ffer (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-= maybe) > > > =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... Don't worry about it. The snippet works great "as is". I'll bet that the "gurus" have scooped this one up. :) Thanks again.