help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs 21 and w3 on Debian


From: Kevin Rodgers
Subject: Re: Emacs 21 and w3 on Debian
Date: Fri, 27 May 2005 10:35:20 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Klaus Straubinger wrote:
> Kevin Rodgers <ihs_4664@yahoo.com> wrote:
>>How exactly is that improvement implemented?
>>
>>(cons redirect-uri url-callback-arguments)
>>
>>(if url-callback-arguments
>>     (cons redirect-uri (cdr url-callback-arguments))
>>   (list redirect-uri))
>
> I chose something like the second alternative:
>
>   (if url-callback-arguments
>       (setcar url-callback-arguments redirect-uri)
>     (setq url-callback-arguments (list redirect-uri)))

Is it necessary to destructively modify url-callback-arguments?  I.e.
is it used elsewhere that must reflect the redirection as well?

Note that setcar does not return the modified cons, so I think that
should be (asssuming setcar is indeed necessary):

  (if url-callback-arguments
      (progn
        (setcar url-callback-arguments redirect-uri)
        url-callback-arguments)
    (setq url-callback-arguments (list redirect-uri)))

> The first would not be correct because the URL sometimes already
> present as first argument in the url-callback-arguments list must be
> replaced.

Again: destructively, or just in this particular call to url-retrieve?

> Would it work then to simply write
>
>   (setq url-callback-arguments
>           (append (list redirect-uri) (cdr url-callback-arguments)))
>
> independent of the value of url-callback-arguments?

Yes, it's not necessary to test url-callback-arguments and it's better
to avoid destructive operations on lists unless you're sure of what
you're doing.

But (append (list x) ...) is better expressed as (cons x ...):

  (cons redirect-uri (cdr url-callback-arguments))

Again, why setq?  Do you really need to change its global value?

--
Kevin Rodgers





reply via email to

[Prev in Thread] Current Thread [Next in Thread]