From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Roy Smith Newsgroups: gmane.emacs.help Subject: Re: How to indent on LOCK(); macro??? Date: Tue, 30 Aug 2005 17:27:24 -0400 Message-ID: <4314CF3C.6020506@panix.com> References: <7E61B3B8-2F39-47D7-B66A-94A3C7C3C255@gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1125439032 10372 80.91.229.2 (30 Aug 2005 21:57:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 30 Aug 2005 21:57:12 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 30 23:57:07 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EAE4Z-0004gH-VE for geh-help-gnu-emacs@m.gmane.org; Tue, 30 Aug 2005 23:55:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EAE8h-0001X6-Vw for geh-help-gnu-emacs@m.gmane.org; Tue, 30 Aug 2005 17:59:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EAE7d-0001Hi-Hc for help-gnu-emacs@gnu.org; Tue, 30 Aug 2005 17:58:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EAE7b-0001HW-SI for help-gnu-emacs@gnu.org; Tue, 30 Aug 2005 17:58:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EAE71-0000xa-Dz for help-gnu-emacs@gnu.org; Tue, 30 Aug 2005 17:57:47 -0400 Original-Received: from [166.84.1.73] (helo=mail2.panix.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EADgF-0002mS-Uw for help-gnu-emacs@gnu.org; Tue, 30 Aug 2005 17:30:08 -0400 Original-Received: from mailspool3.panix.com (mailspool3.panix.com [166.84.1.78]) by mail2.panix.com (Postfix) with ESMTP id 0666E9D9B3; Tue, 30 Aug 2005 17:27:32 -0400 (EDT) Original-Received: from [10.1.16.89] (fly.smarts.com [198.49.114.247]) by mailspool3.panix.com (Postfix) with ESMTP id 28FA9452464; Tue, 30 Aug 2005 17:27:32 -0400 (EDT) User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en Original-To: Denis Bueno In-Reply-To: <7E61B3B8-2F39-47D7-B66A-94A3C7C3C255@gmail.com> X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:29107 Archived-At: Denis Bueno wrote: > On 30 Aug 2005, at 16.51, Roy Smith wrote: > >> I'm working on a project which uses a LOCK/END_LOCK macro pair for >> mutex locking in C++ source files. A typical section of code would >> look like: >> >> LOCK (myDataLock) >> myData = foo; >> END_LOCK >> >> How can I convince the indenting engine to treat the LOCK and END_LOCK >> lines as beginning and ending blocks? > > > If you wrote the macro in a certain way, you can use braces in your > source code (thus obviating your problem): > > #define WITH_MUTEX_LOCK > (l) \ > for (int WITH_MUTEX_LOCK_ret = (0 == pthread_mutex_lock > (l)); \ > > WITH_MUTEX_LOCK_ret; \ > WITH_MUTEX_LOCK_ret = 0, (void) pthread_mutex_unlock > (l)) \ > > That's at least one solution (perhaps not the best). Then you would > write: > > WITH_MUTEX_LOCK (myDataLock) { > myData = foo; > } > > -Denis Thanks, but unfortunately, the macro pre-dates me and isn't going to change. I must live with what I've been given.