From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Doug Lewan Newsgroups: gmane.emacs.help Subject: RE: recompile Date: Thu, 14 Mar 2013 13:16:08 +0000 Message-ID: <155DEC68569B714B86C2C7075F5EDA9828EB07EF@DAKIYA1.pegasus.local> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1363266866 16793 80.91.229.3 (14 Mar 2013 13:14:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Mar 2013 13:14:26 +0000 (UTC) To: lode leroy , "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 14 14:14:50 2013 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 1UG7za-0003q5-NS for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Mar 2013 14:14:46 +0100 Original-Received: from localhost ([::1]:52729 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UG7zE-000726-3H for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Mar 2013 09:14:24 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UG7z0-000714-BT for help-gnu-emacs@gnu.org; Thu, 14 Mar 2013 09:14:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UG7yt-0004AS-2p for help-gnu-emacs@gnu.org; Thu, 14 Mar 2013 09:14:10 -0400 Original-Received: from webmail.shubertorg.com ([207.246.209.200]:36293) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UG7ys-00049k-Ty for help-gnu-emacs@gnu.org; Thu, 14 Mar 2013 09:14:02 -0400 Original-Received: from dakiya1.pegasus.local ([172.16.208.201]) by DAKIYA1.pegasus.local ([172.16.208.201]) with mapi id 14.01.0339.001; Thu, 14 Mar 2013 09:16:08 -0400 Thread-Topic: recompile Thread-Index: AQHOIE5xX2BCXpYghESDee6eqXJQ+ZilJBwg In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.21.202] X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-Received-From: 207.246.209.200 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:89534 Archived-At: lode leroy, The following might do roughly what you want. (defun recompile-current-line () "Rerun the command on the current line in the ~/build directory." (interactive) (let* ((line-text (buffer-substring-no-properties=20 (line-beginning-position) (line-end-position))) (compile-command (concat "cd ~/build && " line-text))) (shell-command compile-command))) There are probably a couple things worth doing if you expect to have more t= asks that need automation. 1. Learn emacs lisp. (You've already hinted at this. The next steps should = help you with this.) 2. Name, save, study and edit your keyboard macros. (More below.) 3. Read the introduction to emacs lisp, `info "Emacs Lisp Intro"' brings it= up. The table of contents alone gives a good idea of what is possible. 4. Use steps 2 & 3 to learn emacs lisp. Regarding keyboard macros: `C-x C-k e' brings up special buffer for editing= keyboard macros. It also contains hints (sometimes wrong unfortunately) ab= out the corresponding lisp functions involved. Here's one that inserts "foo= " with some corrections. Macro: f ;; self-insert-command ooo ;; self-insert-command * 3 C-b ;; backward-char C-k ;; kill-line C-n ;; next-line The corresponding elisp functions are on the right. They suggest the follow= ing function definition: (defun insert-foo-extravagantly () "Insert `foo' extravagantly with some mistakes." (interactive) (insert "fooo") (backward-char) (kill-line) (next-line)) I hope this helps. ,Douglas Douglas Lewan Shubert Ticketing (201) 489-8600 ext 224 Journalism is printing what someone else does not want printed. Everything = else is public relations. - George Orwell From: help-gnu-emacs-bounces+dougl=3Dshubertticketing.com@gnu.org [mailto:h= elp-gnu-emacs-bounces+dougl=3Dshubertticketing.com@gnu.org] On Behalf Of lo= de leroy Sent: Wednesday, 2013 March 13 11:18 To: help-gnu-emacs@gnu.org Subject: recompile I want to define a keyboard macro that does the following: copy the current line, do a few search-and-replace operations and run it in= a shell... I haven't done anything non-trivial in elisp, so I need some help... something along the lines of: (defun recompile-current-line =A0 (beginning-of-line) =A0 (set-mark-command) =A0 (end-of-line) =A0 (copy-region-as-kill) =A0 (shell-command =A0=A0 (replace-regexp "^" "cd ~/build && "=20 =A0=A0=A0 current-kill))) can someone give some advice on how to implement this?