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: Wed, 19 Jan 2011 12:12:25 -0800 (PST) Organization: http://groups.google.com Message-ID: <6726c896-b9a1-4f79-bc63-1ddc42e72fad@p7g2000prb.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> <86afabd2-7f10-4e1f-9799-c4afb267988c@u3g2000vbj.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 1295469632 4459 80.91.229.12 (19 Jan 2011 20:40:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 19 Jan 2011 20: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 Wed Jan 19 21:40:27 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 1PfepO-0001FD-FR for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Jan 2011 21:40:26 +0100 Original-Received: from localhost ([127.0.0.1]:48297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PfepN-0000qv-Rq for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Jan 2011 15:40:25 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!p7g2000prb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 35 Original-NNTP-Posting-Host: 75.154.79.220 Original-X-Trace: posting.google.com 1295467945 22025 127.0.0.1 (19 Jan 2011 20:12:25 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 19 Jan 2011 20:12:25 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p7g2000prb.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:184425 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:78591 Archived-At: On Jan 18, 9:06=A0am, Le Wang wrote: > For completeness, I'll present the yasnippet solution here, it should be > saved under the "fundamental-mode" subdir of the snippets folder. =A0This > expansion key works in any buffer, including the minibuffer: > > # -*- mode: snippet -*- > # name: buffer-file-name-nondir > # key: % > # -- > `(let ((fname (file-name-nondirectory > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (or (buffer-file-name (window-buffer > (minibuffer-selected-window))) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "")))) > =A0 =A0(if (zerop (length fname)) > =A0 =A0 =A0 =A0"%" > =A0 =A0 =A0fname))`$0 > > On Tue, Jan 18, 2011 at 12:05 PM, rusi wrote: > > On Jan 18, 8:42 am, rusi wrote: > > > On Jan 18, 12:07 am, duke wrote: > > : snipped > > > > > 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 :-) > > > Found the original thread > >http://lists.gnu.org/archive/html/help-gnu-emacs/2008-08/msg00433.html > > -- > Le Another useful option! Thanks.