diff options
| author | Stefan Monnier | 2018-07-17 22:22:15 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2018-07-17 22:22:41 -0400 |
| commit | ba6cc1d04cef8e25534a72e90a8f0f8db0026c9f (patch) | |
| tree | 471f0b6438dc86e37c53ca5e4184ee463b21f6ae | |
| parent | 1c79d15863b768fe3156647a54d03a90688dd361 (diff) | |
| download | emacs-ba6cc1d04cef8e25534a72e90a8f0f8db0026c9f.tar.gz emacs-ba6cc1d04cef8e25534a72e90a8f0f8db0026c9f.zip | |
* lisp/net/soap-client.el (soap-type-of): Optimize for Emacs≥26
| -rw-r--r-- | lisp/net/soap-client.el | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 17f83082f8d..f5de05dc3d7 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el | |||
| @@ -685,14 +685,17 @@ This is a specialization of `soap-decode-type' for | |||
| 685 | (anyType (soap-decode-any-type node)) | 685 | (anyType (soap-decode-any-type node)) |
| 686 | (Array (soap-decode-array node)))))) | 686 | (Array (soap-decode-array node)))))) |
| 687 | 687 | ||
| 688 | (defun soap-type-of (element) | 688 | (defalias 'soap-type-of |
| 689 | "Return the type of ELEMENT." | 689 | (if (eq 'soap-xs-basic-type (type-of (make-soap-xs-basic-type))) |
| 690 | ;; Support Emacs < 26 byte-code running in Emacs >= 26 sessions | 690 | ;; `type-of' in Emacs ≥ 26 already does what we need. |
| 691 | ;; (Bug#31742). | 691 | #'type-of |
| 692 | (let ((type (type-of element))) | 692 | ;; For Emacs < 26, use our own function. |
| 693 | (if (eq type 'vector) | 693 | (lambda (element) |
| 694 | (aref element 0) ; For Emacs 25 and earlier. | 694 | "Return the type of ELEMENT." |
| 695 | type))) | 695 | (if (vectorp element) |
| 696 | (aref element 0) ;Assume this vector is actually a struct! | ||
| 697 | ;; This should never happen. | ||
| 698 | (type-of element))))) | ||
| 696 | 699 | ||
| 697 | ;; Register methods for `soap-xs-basic-type' | 700 | ;; Register methods for `soap-xs-basic-type' |
| 698 | (let ((tag (soap-type-of (make-soap-xs-basic-type)))) | 701 | (let ((tag (soap-type-of (make-soap-xs-basic-type)))) |
| @@ -2881,6 +2884,8 @@ reference multiRef parts which are external to RESPONSE-NODE." | |||
| 2881 | 2884 | ||
| 2882 | ;;;; SOAP type encoding | 2885 | ;;;; SOAP type encoding |
| 2883 | 2886 | ||
| 2887 | ;; FIXME: Use `cl-defmethod' (but this requires Emacs-25). | ||
| 2888 | |||
| 2884 | (defun soap-encode-attributes (value type) | 2889 | (defun soap-encode-attributes (value type) |
| 2885 | "Encode XML attributes for VALUE according to TYPE. | 2890 | "Encode XML attributes for VALUE according to TYPE. |
| 2886 | This is a generic function which determines the attribute encoder | 2891 | This is a generic function which determines the attribute encoder |