From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.help Subject: Re: How to recompile single file or rerun single compilation command in compilation mode ? Date: Thu, 08 Mar 2012 09:01:24 +0100 Message-ID: <878vjbh67f.fsf@gnuvola.org> References: <4D8CF158-3C8E-43E0-920A-5C4AC116A469@Web.DE> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1331193826 23648 80.91.229.3 (8 Mar 2012 08:03:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 8 Mar 2012 08:03:46 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Nash Steve Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 08 09:03:46 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 1S5YK8-0000mG-EJ for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Mar 2012 09:03:44 +0100 Original-Received: from localhost ([::1]:52588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5YK7-0000Lg-Py for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Mar 2012 03:03:43 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5YJj-00082U-GK for help-gnu-emacs@gnu.org; Thu, 08 Mar 2012 03:03:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5YJL-0006ZX-34 for help-gnu-emacs@gnu.org; Thu, 08 Mar 2012 03:03:19 -0500 Original-Received: from smtp206.alice.it ([82.57.200.102]:60787) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5YJK-0006Wl-N6 for help-gnu-emacs@gnu.org; Thu, 08 Mar 2012 03:02:55 -0500 Original-Received: from ambire (95.236.70.183) by smtp206.alice.it (8.6.023.02) id 4F1836AD0613CAA3; Thu, 8 Mar 2012 09:02:34 +0100 Original-Received: from ttn by ambire with local (Exim 4.72) (envelope-from ) id 1S5YHs-0000wR-9d; Thu, 08 Mar 2012 09:01:24 +0100 In-Reply-To: (Nash Steve's message of "Wed, 7 Mar 2012 10:44:40 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.102 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:83975 Archived-At: () Nash Steve () Wed, 7 Mar 2012 10:44:40 -0500 I want to run a line in compilation-mode buffer as a compile command. e.g. after M-x compile RET make, I just want to pick a line of make output as a command to run. Maybe something like this (only lightly tested)? (require 'thingatpt) (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 dir)) (compile (format "%s" command))))) (define-key compilation-mode-map "\C-c\C-a" ; "a" for "again" 'compilation-compile-with-current-line)