From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Peter Lee Newsgroups: gmane.emacs.help Subject: A little lisp help Date: Tue, 21 Jan 2003 19:06:45 GMT Organization: Prodigy Internet http://www.prodigy.com Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1043176538 32495 80.91.224.249 (21 Jan 2003 19:15:38 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 21 Jan 2003 19:15:38 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18b3rL-0008Pa-00 for ; Tue, 21 Jan 2003 20:14:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18b3ny-0007fq-02 for gnu-help-gnu-emacs@m.gmane.org; Tue, 21 Jan 2003 14:11:26 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!207.115.63.142!prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr11.news.prodigy.com.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 41 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 Original-NNTP-Posting-Host: 216.62.199.3 Original-X-Complaints-To: abuse@prodigy.net Original-X-Trace: newssvr11.news.prodigy.com 1043176005 ST000 216.62.199.3 (Tue, 21 Jan 2003 14:06:45 EST) Original-NNTP-Posting-Date: Tue, 21 Jan 2003 14:06:45 EST X-UserInfo1: FKPO@MC@@S@SSTX[KZD\_T@@USXHQD\MNPWZKB]MPXHJUZ]CDVW[AKK[J\]^HVKHG^EWZHBLO^[\NH_AZFWGN^\DHNVMX_DHHX[FSQKBOTS@@BP^]C@RHS_AGDDC[AJM_T[GZNRNZAY]GNCPBDYKOLK^_CZFWPGHZIXW@C[AFKBBQS@E@DAZ]VDFUNTQQ]FN Original-Xref: shelby.stanford.edu gnu.emacs.help:109315 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5839 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5839 I'm learning lisp atm, and decided to write a macro to insert curly braces around a region and re-indent. So for this, if (x) y=0; z=0; w=0; * setting mark at begining of line y=0 and setting point at * would produce the following. if (x) { y=0; z=0; w=0; } This is what I have so far, but it doesn't work very well. (defun curly-brace-region (mark point) "Inserts curly braces around region and indents" (interactive "r") (message "point=%d, mark=%d" point mark) (goto-char mark) (insert-string "{") (newline-and-indent) (goto-char point) (insert-string "}") (newline-and-indent) (fill-region mark point)) There's probably functions to make this trivial and I'm just missing them due to lack of familiarity. TIA.