From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jos=E9_A=2E_Romero_L=2E?= Newsgroups: gmane.emacs.help Subject: Re: How to put this in a macro Date: Sat, 17 Apr 2010 16:58:44 -0700 (PDT) Organization: http://groups.google.com Message-ID: <020d7028-6556-4953-b614-dcb16d98517a@j17g2000yqa.googlegroups.com> References: <87pr1zw164.fsf@linux-lqcw.site> <87d3xywpm6.fsf@linux-lqcw.site> <87633qwd5l.fsf@linux-lqcw.site> <871veewblx.fsf@linux-lqcw.site> <0b67cc27-1c96-459b-a8f8-435cef946281@q15g2000yqj.googlegroups.com> <878w8l6fa6.fsf@linux-lqcw.site> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1273009827 21486 80.91.229.12 (4 May 2010 21:50:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 4 May 2010 21:50:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 04 23:50:26 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O9Q0W-0007zI-5O for geh-help-gnu-emacs@m.gmane.org; Tue, 04 May 2010 23:50:24 +0200 Original-Received: from localhost ([127.0.0.1]:58573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9Q0V-00087s-NU for geh-help-gnu-emacs@m.gmane.org; Tue, 04 May 2010 17:50:23 -0400 Original-Path: usenet.stanford.edu!postnews.google.com!j17g2000yqa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 33 Original-NNTP-Posting-Host: 89.78.68.41 Original-X-Trace: posting.google.com 1271548724 1030 127.0.0.1 (17 Apr 2010 23:58:44 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 17 Apr 2010 23:58:44 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j17g2000yqa.googlegroups.com; posting-host=89.78.68.41; posting-account=mkEKGAoAAACAV2vhv5r9WHXWqsdL_niD User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3,gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:177759 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:73205 Archived-At: On 17 Kwi, 21:38, Cecil Westerhof wrote: (...) > beginning. So it is not really important at the moment. But I like to > make robust code, and when in the future the macro is used where it is a > problem when the start is after the end ... So is it possible to switch > the values when the end is before the start? (...) If you're in for a bit of coding stunts :-) I guess we could have one last try, using your name, Barry's macro and shorter variable names: (defmacro dcbl-set-bounds (start end) `(progn (if (equal ,start ,end) (setq ,start (point-min) ,end (point-max)) (setq ,start (or ,start (point-min)) ,end (or ,end (point-max)))) (setq ,start (list ,start ,end) ,start (sort ,start '<) ,end (second ,start) ,start (first ,start)))) it should be OK to use one of the variables being changed as the temp var, shouldn't it? Cheers, -- Jos=E9 A. Romero L. escherdragon at gmail "We who cut mere stones must always be envisioning cathedrals." (Quarry worker's creed)