all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Cecil Westerhof <Cecil@decebal.nl>
To: help-gnu-emacs@gnu.org
Subject: Re: How to put this in a macro
Date: Sat, 17 Apr 2010 21:38:09 +0200	[thread overview]
Message-ID: <878w8l6fa6.fsf@linux-lqcw.site> (raw)
In-Reply-To: 0b67cc27-1c96-459b-a8f8-435cef946281@q15g2000yqj.googlegroups.com

José A. Romero L. <escherdragon@gmail.com> writes:

>>            (if (> (symbol-value ,start-sym) (symbol-value ,end-sym))
>>                (let ((temp (symbol-value ,start-sym)))
>>                  (set ,start-sym (symbol-value ,end-sym))
>>                  (set ,end-sym   temp)))))
>>
>> I also make sure now that start is not after end.
> (...)
>
> Hmm, be careful with lets inside macros - this will work OK until one
> of the variables you try to set is named precisely "temp" (no lexical
> scope, remember?).

I deleted it again. It is at the moment not important, because all the
functions that use the macro do not care if the end is before the
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?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


  parent reply	other threads:[~2010-04-17 19:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-16 21:13 How to put this in a macro Cecil Westerhof
2010-04-16 23:28 ` José A. Romero L.
2010-04-17  3:08 ` Barry Margolin
2010-04-17  6:38   ` Cecil Westerhof
2010-04-17 10:30     ` José A. Romero L.
2010-04-17 11:07       ` Cecil Westerhof
2010-04-17 11:40         ` Cecil Westerhof
2010-04-17 15:15           ` José A. Romero L.
2010-04-17 16:49             ` Barry Margolin
2010-04-17 16:57               ` José A. Romero L.
2010-04-17 21:41                 ` Barry Margolin
2010-04-17 19:38             ` Cecil Westerhof [this message]
2010-04-17 23:58               ` José A. Romero L.
2010-04-17 12:13         ` José A. Romero L.
2010-04-17 15:14       ` Barry Margolin
2010-04-17 16:49         ` José A. Romero L.
2010-04-17 15:12     ` Barry Margolin
2010-04-18  7:50 ` Pascal J. Bourguignon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878w8l6fa6.fsf@linux-lqcw.site \
    --to=cecil@decebal.nl \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.