emacs-devel
[Top][All Lists]
Advanced

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

Re: [elpa] externals/debbugs b8c84dbe4b: Improve needed advice


From: Stefan Monnier
Subject: Re: [elpa] externals/debbugs b8c84dbe4b: Improve needed advice
Date: Thu, 12 Sep 2024 15:52:08 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Michael,

> +(defvar debbugs-compat-url-http-attempt-keepalives nil
> +  "Temporary storage for `'.")
> +(defun debbugs-compat-add-debbugs-advice ()
> +  (with-no-warnings
> +    (setq debbugs-compat-url-http-attempt-keepalives
> +          url-http-attempt-keepalives))
> +  (advice-add
> +   'url-http-create-request :around
> +   (lambda (orig-fun)
> +     "Set `url-http-attempt-keepalives' to nil."
> +     (with-no-warnings (setq url-http-attempt-keepalives nil))
> +     (funcall orig-fun))
> +   '(name debbugs-advice)))
> +
> +(defun debbugs-compat-remove-debbugs-advice ()
> +  (advice-remove 'url-http-create-request 'debbugs-advice)
> +  (with-no-warnings
> +    (setq url-http-attempt-keepalives
> +          debbugs-compat-url-http-attempt-keepalives)))
[...]
> +(defun debbugs-soap-invoke (operation-name &rest parameters)
> +  "Invoke the SOAP connection.
> +OPERATION-NAME and PARAMETERS are as described in `soap-invoke'."
> +  (debbugs-compat-add-debbugs-advice)
> +  (prog1
> +      (apply #'soap-invoke operation-name parameters)
> +    (debbugs-compat-remove-debbugs-advice)))

I wonder you're doing it this way instead of the "more obvious":

    (defun debbugs-soap-invoke (operation-name &rest parameters)
      "Invoke the SOAP connection.
    OPERATION-NAME and PARAMETERS are as described in `soap-invoke'."
      (let ((url-http-attempt-keepalives nil))
        (apply #'soap-invoke operation-name parameters)))


- Stefan




reply via email to

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