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: Re: A little lisp help Date: Tue, 21 Jan 2003 21:52:52 GMT Organization: Prodigy Internet http://www.prodigy.com Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1043186059 13378 80.91.224.249 (21 Jan 2003 21:54:19 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 21 Jan 2003 21:54:19 +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 18b6LZ-0003TU-00 for ; Tue, 21 Jan 2003 22:54:17 +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 18b6Mh-000136-09 for gnu-help-gnu-emacs@m.gmane.org; Tue, 21 Jan 2003 16:55:27 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.ems.psu.edu!news.cse.psu.edu!elk.ncren.net!arclight.uoregon.edu!wn14feed!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: 28 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 1043185972 ST000 216.62.199.3 (Tue, 21 Jan 2003 16:52:52 EST) Original-NNTP-Posting-Date: Tue, 21 Jan 2003 16:52:52 EST X-UserInfo1: FKPO@SFGPBSYRIXXKJJD]_HBWB]^PCPDLXUNNHLIWIWTEPIB_NVUAH_[BL[\IRKIANGGJBFNJF_DOLSCENSY^U@FRFUEXR@KFXYDBPWBCDQJA@X_DCBHXR[C@\EOKCJLED_SZ@RMWYXYWE_P@\\GOIW^@SYFFSWHFIXMADO@^[ADPRPETLBJ]RDGENSKQQZN Original-Xref: shelby.stanford.edu gnu.emacs.help:109322 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:5846 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5846 Ok this is what I have so far. (defun curly-brace-region (m p) "Inserts curly braces around region and indents" (interactive "r") ;; (message "mark=%d, point=%d" m p) (kill-region m p) (insert-string "{") (newline-and-indent) (insert-string "}") (newline-and-indent) (previous-line 2) (newline-and-indent) (yank 1) (kill-line) (next-line 1) (indent-region (- m 1) (point) nil)) (global-set-key "\M-]" 'curly-brace-region) It works great when I mark a region and type: M-x curly-brace-region. However, it doesn't work the same way when I M-]. In this case the first curly brace is never inserted and the formatting is way off. Anyone know why they would behave differently ? Thanks.