From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nash Steve Newsgroups: gmane.emacs.help Subject: Re: How to recompile single file or rerun single compilation command in compilation mode ? Date: Thu, 8 Mar 2012 13:21:40 -0500 Message-ID: References: <4D8CF158-3C8E-43E0-920A-5C4AC116A469@Web.DE> <878vjbh67f.fsf@gnuvola.org> <87zkbrfpth.fsf@gnuvola.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec5015f2bec4ce604babf5878 X-Trace: dough.gmane.org 1331230915 23943 80.91.229.3 (8 Mar 2012 18:21:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 8 Mar 2012 18:21:55 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Thien-Thi Nguyen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 08 19:21:54 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S5hyM-0006Dr-Do for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Mar 2012 19:21:54 +0100 Original-Received: from localhost ([::1]:41533 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5hyL-0000gJ-Hr for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Mar 2012 13:21:53 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:51195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5hyF-0000fN-Pt for help-gnu-emacs@gnu.org; Thu, 08 Mar 2012 13:21:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5hyA-0000tf-VF for help-gnu-emacs@gnu.org; Thu, 08 Mar 2012 13:21:47 -0500 Original-Received: from mail-vw0-f41.google.com ([209.85.212.41]:59470) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5hyA-0000tN-Nz for help-gnu-emacs@gnu.org; Thu, 08 Mar 2012 13:21:42 -0500 Original-Received: by vbbey12 with SMTP id ey12so735385vbb.0 for ; Thu, 08 Mar 2012 10:21:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=AIMZ/tgvLz7ZbCsdpF2bWTOZcaBbZCOFOy1XMWLt/pU=; b=EpjdE7dtV2xYXu01k7ykfIfVOF6jsSR8t01tbBrHDIibOQKRxCrba+mU/Qzu3pZvzv YUyL9s2Wti/0OMi53jxn1KW+7UI/jJfFuMNM3d/pmP6yxezoG+62l816PPLKHPw/Zq7a wY55ee1S70YuuEDwzQekXsHCRUv+qFXLPEVec3TyqBwrykCqThq5wGrT1qsvhFACCBOy K5isCtrl2A3XBwc9ZozAoJNXYPmbqGvenbXzDp/cAXXab+goo5DuX3fB463i8xK4MPfm lnzqjj+SxO7GOe4kyk4e9va8ePk/1k4k7yeBHvWgifLcnffm/W0rxHVvdsxCWHQKryND yV1A== Original-Received: by 10.52.94.148 with SMTP id dc20mr11551347vdb.100.1331230900243; Thu, 08 Mar 2012 10:21:40 -0800 (PST) Original-Received: by 10.52.33.212 with HTTP; Thu, 8 Mar 2012 10:21:40 -0800 (PST) In-Reply-To: <87zkbrfpth.fsf@gnuvola.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.41 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:83984 Archived-At: --bcaec5015f2bec4ce604babf5878 Content-Type: text/plain; charset=UTF-8 It works great! Thanks very much! On Thu, Mar 8, 2012 at 3:40 AM, Thien-Thi Nguyen wrote: > The previous code fails if COMMAND starts with a relative directory. > This version is more robust in that regard: > > (defun compilation-compile-with-current-line (dir) > "Extract the current line as a command and execute it in DIR." > (interactive "DExecute command in directory: ") > (let ((command (substring-no-properties (thing-at-point 'line) 0 -1))) > ;; Do it this way instead of using "cd DIR; COMMAND" > ;; to avoid outrageous prefixing on repeated invocations. > (let ((default-directory (file-name-as-directory dir))) > (compile command)))) > --bcaec5015f2bec4ce604babf5878 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable It works great!
Thanks very much!

O= n Thu, Mar 8, 2012 at 3:40 AM, Thien-Thi Nguyen <ttn@gnuvola.org> wrote:
The previous code fails if COMMAND starts with a relative directory.
This version is more robust in that regard:

(defun compilation-compile-with-current-line (dir)
=C2=A0"Extract the current line as a command and execute it in DIR.&q= uot;
=C2=A0(interactive "DExecute command in directory: ")
=C2=A0(let ((command (substring-no-properties (thing-at-point 'line) 0= -1)))
=C2=A0 =C2=A0;; Do it this way instead of using "cd DIR; COMMAND"= ;
=C2=A0 =C2=A0;; to avoid outrageous prefixing on repeated invocations.
=C2=A0 =C2=A0(let ((default-directory (file-name-as-directory dir)))=
=C2=A0 =C2=A0 =C2=A0(compile command))))

--bcaec5015f2bec4ce604babf5878--