Klaus Straubinger wrote:
> Kevin Rodgers <[EMAIL PROTECTED]> 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



_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to