From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Le Wang Newsgroups: gmane.emacs.help Subject: Re: Passing current buffer to compile command Date: Wed, 19 Jan 2011 00:06:10 +0800 Message-ID: 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: multipart/alternative; boundary=90e6ba61533a35293a049a2114e4 X-Trace: dough.gmane.org 1295366937 30847 80.91.229.12 (18 Jan 2011 16:08:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 18 Jan 2011 16:08:57 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: rusi Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 18 17:08:52 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 1PfE6x-0000H6-F7 for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Jan 2011 17:08:48 +0100 Original-Received: from localhost ([127.0.0.1]:42569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PfE6w-00085T-MY for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Jan 2011 11:08:46 -0500 Original-Received: from [140.186.70.92] (port=46985 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PfE4h-0007EJ-1g for help-gnu-emacs@gnu.org; Tue, 18 Jan 2011 11:06:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PfE4S-000746-E3 for help-gnu-emacs@gnu.org; Tue, 18 Jan 2011 11:06:26 -0500 Original-Received: from mail-ew0-f41.google.com ([209.85.215.41]:46459) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PfE4S-00073X-8A for help-gnu-emacs@gnu.org; Tue, 18 Jan 2011 11:06:12 -0500 Original-Received: by ewy27 with SMTP id 27so3152246ewy.0 for ; Tue, 18 Jan 2011 08:06:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=XEvjhJAsfbzCpZRoeAv3D2ewvi9G2rnJZOasFoLZA3s=; b=D8QXy3/Mgz7kT/aOh4tZZqCRbzB6xbtPmXXxy/MnqxM4FkGJRj1Fi4QXhCkeohskIY ZKC/vG5tdSwj7fp8EDqe2Qq9PcOBisP2yw/4xSyynid2j+vr0hXzuGY8g0wq5xxkL5VL 5VkEOYgl5uVeGu6eRCD+tzNREhcTFV/rzuamk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=qcLvehCiF2wBfQtXXiUXt9NgGcboFO5tNFQTC/QLsw+xfE3KnVRccmXJp+9bZOfLdF /X2bj0yNFbTiY5Kxu1mqgtyxcatfBtwzwoZG9rpyfA44O5NbjSEdO8pXoUfJoMZMwC9s o3HzN09HQWpQGQRT+aPJbM+cKJSLE9WfBmj1c= Original-Received: by 10.14.119.132 with SMTP id n4mr4379091eeh.17.1295366770468; Tue, 18 Jan 2011 08:06:10 -0800 (PST) Original-Received: by 10.14.119.11 with HTTP; Tue, 18 Jan 2011 08:06:10 -0800 (PST) In-Reply-To: <86afabd2-7f10-4e1f-9799-c4afb267988c@u3g2000vbj.googlegroups.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:78545 Archived-At: --90e6ba61533a35293a049a2114e4 Content-Type: text/plain; charset=ISO-8859-1 For completeness, I'll present the yasnippet solution here, it should be saved under the "fundamental-mode" subdir of the snippets folder. This expansion key works in any buffer, including the minibuffer: # -*- mode: snippet -*- # name: buffer-file-name-nondir # key: % # -- `(let ((fname (file-name-nondirectory (or (buffer-file-name (window-buffer (minibuffer-selected-window))) "")))) (if (zerop (length fname)) "%" fname))`$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 --90e6ba61533a35293a049a2114e4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable For completeness, I'll present the yasnippet solution here, it should b= e saved under the "fundamental-mode" subdir of the snippets folde= r. =A0This expansion key works in any buffer, including the minibuffer:
# -*- mode: snippet -*-
# name: buffer-file-name-nondir
# = key: %
# --
`(let ((fname (file-name-nondirec= tory
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(or (buffer-fil= e-name (window-buffer (minibuffer-selected-window)))
= =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0""))))
=A0=A0 (if (zerop (length fname))
=A0= =A0 =A0 =A0 "%"
=A0=A0 =A0 fname))`$0
<= /div>

On Tue, Jan 18, 2011 = at 12:05 PM, rusi <rustompmody@gmail.com> wrote:
On Jan 18, 8:42=A0am, rus= i <rustompm...@gmail.com>= ; wrote:
> On Jan 18, 12:07=A0am, duke <sidney.reilley...@gmail.com> wrote:
: snipped
>
> > You are too kind! Much obliged for the snippet, but especially th= e
> > 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
--90e6ba61533a35293a049a2114e4--