commit 58862751bde2611d9ea99a33ecb5b0c13a7513b9 (HEAD, refs/remotes/origin/master) Author: Glenn Morris Date: Thu Mar 17 00:14:11 2016 -0700 Simplify some rococo Gnus code that loads or tests for other libraries. * lisp/gnus/gnus-art.el (gnus-treat-ansi-sequences): Simplify default. * lisp/gnus/mml-smime.el (epg): Simply require it. (mml-smime-use): Simplify the default. Doc fix. * lisp/gnus/mml2015.el (epg-config): Require it. (mml2015-use): Simplify the default. * lisp/gnus/smime.el (password-cache): Simply require it. (password-read-and-add): Remove declaration. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 4d8cb80..ca47582 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -1393,7 +1393,7 @@ predicate. See Info node `(gnus)Customizing Articles'." :type gnus-article-treat-custom) (put 'gnus-treat-overstrike 'highlight t) -(defcustom gnus-treat-ansi-sequences (if (locate-library "ansi-color") t) +(defcustom gnus-treat-ansi-sequences t "Treat ANSI SGR control sequences. Valid values are nil, t, `head', `first', `last', an integer or a predicate. See Info node `(gnus)Customizing Articles'." diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el index 02e602c..e473a6d 100644 --- a/lisp/gnus/mml-smime.el +++ b/lisp/gnus/mml-smime.el @@ -32,17 +32,17 @@ (autoload 'message-narrow-to-headers "message") (autoload 'message-fetch-field "message") -;; Prefer epg over openssl if it is available as epg uses GnuPG's gpgsm, +;; Prefer epg over openssl as epg uses GnuPG's gpgsm, ;; which features full-fledged certificate management, while openssl requires ;; major manual efforts for certificate revocation and expiry and has bugs ;; as documented under man smime(1). -(ignore-errors (require 'epg)) +(require 'epg) -(defcustom mml-smime-use (if (featurep 'epg) 'epg 'openssl) +(defcustom mml-smime-use 'epg "Whether to use OpenSSL or EasyPG (EPG) to handle S/MIME messages. -Defaults to EPG if it's available. -If you think about using OpenSSL, please read the BUGS section in the manual -for the `smime' command coming with OpenSSL first. EasyPG is recommended." +If you're thinking about using OpenSSL, please first read the BUGS section +in the manual for the `smime' command that comes with OpenSSL. +We recommend EasyPG." :group 'mime-security :type '(choice (const :tag "EPG" epg) (const :tag "OpenSSL" openssl))) diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el index 309f1a7..0d64849 100644 --- a/lisp/gnus/mml2015.el +++ b/lisp/gnus/mml2015.el @@ -37,6 +37,7 @@ (require 'mm-util) (require 'mml) (require 'mml-sec) +(require 'epg-config) (defvar mc-pgp-always-sign) @@ -47,27 +48,7 @@ ;; Maybe this should be in eg mml-sec.el (and have a different name). ;; Then mml1991 would not need to require mml2015, and mml1991-use ;; could be removed. -(defvar mml2015-use (or - (progn - (ignore-errors (require 'epg-config)) - (and (fboundp 'epg-check-configuration) - 'epg)) - (progn - (let ((abs-file (locate-library "pgg"))) - ;; Don't load PGG if it is marked as obsolete - ;; (Emacs 24). - (when (and abs-file - (not (string-match "/obsolete/[^/]*\\'" - abs-file))) - (ignore-errors (require 'pgg)) - (and (fboundp 'pgg-sign-region) - 'pgg)))) - (progn (ignore-errors - (load "mc-toplev")) - (and (fboundp 'mc-encrypt-generic) - (fboundp 'mc-sign-generic) - (fboundp 'mc-cleanup-recipient-headers) - 'mailcrypt))) +(defvar mml2015-use 'epg "The package used for PGP/MIME. Valid packages include `epg', `pgg' and `mailcrypt'.") diff --git a/lisp/gnus/smime.el b/lisp/gnus/smime.el index 44841a7..9bec58a 100644 --- a/lisp/gnus/smime.el +++ b/lisp/gnus/smime.el @@ -120,9 +120,7 @@ (require 'dig) -(if (locate-library "password-cache") - (require 'password-cache) - (require 'password)) +(require 'password-cache) (eval-when-compile (require 'cl)) @@ -231,9 +229,6 @@ must be set in `ldap-host-parameters-alist'." (defvar smime-details-buffer "*OpenSSL output*") -;; Password dialog function -(declare-function password-read-and-add "password-cache" (prompt &optional key)) - (defun smime-ask-passphrase (&optional cache-key) "Asks the passphrase to unlock the secret key. If `cache-key' and `password-cache' is non-nil then cache the commit 327c31b33cb175623aa788613c031a5acc4c856f Author: Glenn Morris Date: Wed Mar 16 08:58:10 2016 -0700 * test/lisp/dabbrev-tests.el: Merge fix: move here from test/automated. diff --git a/test/automated/dabbrev-tests.el b/test/automated/dabbrev-tests.el deleted file mode 100644 index 9c7a838..0000000 --- a/test/automated/dabbrev-tests.el +++ /dev/null @@ -1,42 +0,0 @@ -;;; dabbrev-tests.el --- Test suite for dabbrev. - -;; Copyright (C) 2016 Free Software Foundation, Inc. - -;; Author: Alan Third -;; Keywords: dabbrev - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;;; Code: - -(require 'ert) -(require 'dabbrev) - -(ert-deftest dabbrev-expand-test () - "Test for bug#1948. -When DABBREV-ELIMINATE-NEWLINES is non-nil (the default), -repeated calls to DABBREV-EXPAND can result in the source of -first expansion being replaced rather than the destination." - (with-temp-buffer - (insert "ab x\na\nab y") - (goto-char 8) - (save-window-excursion - (set-window-buffer nil (current-buffer)) - ;; M-/ SPC M-/ M-/ - (execute-kbd-macro "\257 \257\257")) - (should (string= (buffer-string) "ab x\nab y\nab y")))) diff --git a/test/lisp/dabbrev-tests.el b/test/lisp/dabbrev-tests.el new file mode 100644 index 0000000..9c7a838 --- /dev/null +++ b/test/lisp/dabbrev-tests.el @@ -0,0 +1,42 @@ +;;; dabbrev-tests.el --- Test suite for dabbrev. + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; Author: Alan Third +;; Keywords: dabbrev + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'dabbrev) + +(ert-deftest dabbrev-expand-test () + "Test for bug#1948. +When DABBREV-ELIMINATE-NEWLINES is non-nil (the default), +repeated calls to DABBREV-EXPAND can result in the source of +first expansion being replaced rather than the destination." + (with-temp-buffer + (insert "ab x\na\nab y") + (goto-char 8) + (save-window-excursion + (set-window-buffer nil (current-buffer)) + ;; M-/ SPC M-/ M-/ + (execute-kbd-macro "\257 \257\257")) + (should (string= (buffer-string) "ab x\nab y\nab y")))) commit 6e3d1682eefd7a9e2ac0c707d48de7adec5ab0a3 Author: Thomas Fitzsimmons Date: Wed Mar 16 11:03:31 2016 -0400 Sync with soap-client repository, version 3.1.1 * lisp/net/soap-client.el (soap-encode-xs-complex-type): Fix error message. (soap-find-port): Delete trailing whitespace. (soap-find-operation): Fix documentation and rename parameter. (soap-find-port): Likewise. (soap-operation-arity): Likewise. * lisp/net/soap-client.el: Update copyright years. (soap-warning): Fix docstring quoting. (soap-decode-date-time): Likewise. (soap-validate-xs-simple-type): Remove tabs for indentation. * lisp/net/soap-inspect.el: Update copyright years. * lisp/net/soap-client.el (soap-encode-xs-basic-type): Do not assume xsd:base64Binary values are UTF-8 strings. (soap-decode-xs-basic-type): Likewise. (soap-invoke): Document xsd:base64Binary handling. * lisp/net/soap-client.el (soap-find-port, soap-find-operation) (soap-operation-arity): new defuns (soap-invoke-internal): use soap-find-port, soap-find-operation. Co-authored-by: Alex Harsanyi diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 7402464..f8973a3 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -5,7 +5,7 @@ ;; Author: Alexandru Harsanyi ;; Author: Thomas Fitzsimmons ;; Created: December, 2009 -;; Version: 3.0.2 +;; Version: 3.1.1 ;; Keywords: soap, web-services, comm, hypermedia ;; Package: soap-client ;; Homepage: https://github.com/alex-hhh/emacs-soap-client @@ -538,7 +538,7 @@ This is a specialization of `soap-encode-value' for (base64Binary (unless (stringp value) (error "Not a string value for base64Binary")) - (base64-encode-string (encode-coding-string value 'utf-8))) + (base64-encode-string value)) (otherwise (error "Don't know how to encode %s for type %s" @@ -682,7 +682,7 @@ This is a specialization of `soap-decode-type' for decimal byte float double duration) (string-to-number (car contents))) (boolean (string= (downcase (car contents)) "true")) - (base64Binary (decode-coding-string (base64-decode-string (car contents)) 'utf-8)) + (base64Binary (base64-decode-string (car contents))) (anyType (soap-decode-any-type node)) (Array (soap-decode-array node)))))) @@ -1249,8 +1249,8 @@ See also `soap-wsdl-resolve-references'." (when messages (error (mapconcat 'identity (nreverse messages) "; and: ")))) (cl-labels ((fail-with-message (format value) - (push (format format value) messages) - (throw 'invalid nil))) + (push (format format value) messages) + (throw 'invalid nil))) (catch 'invalid (let ((enumeration (soap-xs-simple-type-enumeration type))) (when (and (> (length enumeration) 1) @@ -1630,7 +1630,7 @@ This is a specialization of `soap-encode-value' for `soap-xs-complex-type' objects." (case (soap-xs-complex-type-indicator type) (array - (error "soap-encode-xs-complex-type arrays are handled elsewhere")) + (error "Arrays of type soap-encode-xs-complex-type are handled elsewhere")) ((sequence choice all nil) (let ((type-list (list type))) @@ -2999,6 +2999,33 @@ http://schemas.xmlsoap.org/soap/encoding/\"\n")) :type 'boolean :group 'soap-client) +(defun soap-find-port (wsdl service) + "Return the WSDL port having SERVICE name. +Signal an error if not found." + (or (catch 'found + (dolist (p (soap-wsdl-ports wsdl)) + (when (equal service (soap-element-name p)) + (throw 'found p)))) + (error "Unknown SOAP service: %s" service))) + +(defun soap-find-operation (port operation-name) + "Inside PORT, find OPERATION-NAME, a `soap-port-type'. +Signal an error if not found." + (let* ((binding (soap-port-binding port)) + (op (gethash operation-name (soap-binding-operations binding)))) + (or op + (error "No operation %s for SOAP service %s" + operation-name (soap-element-name port))))) + +(defun soap-operation-arity (wsdl service operation-name) + "Return the number of arguments required by a soap operation. +WSDL, SERVICE, OPERATION-NAME and PARAMETERS are as described in +`soap-invoke'." + (let* ((port (soap-find-port wsdl service)) + (op (soap-find-operation port operation-name)) + (bop (soap-bound-operation-operation op))) + (length (soap-operation-parameter-order bop)))) + (defun soap-invoke-internal (callback cbargs wsdl service operation-name &rest parameters) "Implement `soap-invoke' and `soap-invoke-async'. @@ -3006,54 +3033,43 @@ If CALLBACK is non-nil, operate asynchronously, then call CALLBACK as (apply CALLBACK RESPONSE CBARGS), where RESPONSE is the SOAP invocation result. If CALLBACK is nil, operate synchronously. WSDL, SERVICE, OPERATION-NAME and PARAMETERS are as described in `soap-invoke'." - (let ((port (catch 'found - (dolist (p (soap-wsdl-ports wsdl)) - (when (equal service (soap-element-name p)) - (throw 'found p)))))) - (unless port - (error "Unknown SOAP service: %s" service)) - - (let* ((binding (soap-port-binding port)) - (operation (gethash operation-name - (soap-binding-operations binding)))) - (unless operation - (error "No operation %s for SOAP service %s" operation-name service)) - - (let ((url-request-method "POST") - (url-package-name "soap-client.el") - (url-package-version "1.0") - (url-request-data - ;; url-request-data expects a unibyte string already encoded... - (encode-coding-string - (soap-create-envelope operation parameters wsdl - (soap-port-service-url port)) - 'utf-8)) - (url-mime-charset-string "utf-8;q=1, iso-8859-1;q=0.5") - (url-http-attempt-keepalives t) - (url-request-extra-headers - (list - (cons "SOAPAction" - (concat "\"" (soap-bound-operation-soap-action - operation) "\"")) - (cons "Content-Type" - "text/xml; charset=utf-8")))) - (if callback - (url-retrieve - (soap-port-service-url port) - (lambda (status) - (let ((data-buffer (current-buffer))) - (unwind-protect - (let ((error-status (plist-get status :error))) - (if error-status - (signal (car error-status) (cdr error-status)) - (apply callback - (soap-parse-envelope - (soap-parse-server-response) - operation wsdl) - cbargs))) - ;; Ensure the url-retrieve buffer is not leaked. - (and (buffer-live-p data-buffer) - (kill-buffer data-buffer)))))) + (let* ((port (soap-find-port wsdl service)) + (operation (soap-find-operation port operation-name))) + (let ((url-request-method "POST") + (url-package-name "soap-client.el") + (url-package-version "1.0") + (url-request-data + ;; url-request-data expects a unibyte string already encoded... + (encode-coding-string + (soap-create-envelope operation parameters wsdl + (soap-port-service-url port)) + 'utf-8)) + (url-mime-charset-string "utf-8;q=1, iso-8859-1;q=0.5") + (url-http-attempt-keepalives t) + (url-request-extra-headers + (list + (cons "SOAPAction" + (concat "\"" (soap-bound-operation-soap-action + operation) "\"")) + (cons "Content-Type" + "text/xml; charset=utf-8")))) + (if callback + (url-retrieve + (soap-port-service-url port) + (lambda (status) + (let ((data-buffer (current-buffer))) + (unwind-protect + (let ((error-status (plist-get status :error))) + (if error-status + (signal (car error-status) (cdr error-status)) + (apply callback + (soap-parse-envelope + (soap-parse-server-response) + operation wsdl) + cbargs))) + ;; Ensure the url-retrieve buffer is not leaked. + (and (buffer-live-p data-buffer) + (kill-buffer data-buffer)))))) (let ((buffer (url-retrieve-synchronously (soap-port-service-url port)))) (condition-case err @@ -3077,7 +3093,7 @@ OPERATION-NAME and PARAMETERS are as described in `soap-invoke'." (error (when soap-debug (pop-to-buffer buffer)) - (error (error-message-string err)))))))))) + (error (error-message-string err))))))))) (defun soap-invoke (wsdl service operation-name &rest parameters) "Invoke a SOAP operation and return the result. @@ -3096,7 +3112,11 @@ the SOAP request. NOTE: The SOAP service provider should document the available operations and their parameters for the service. You can also use the `soap-inspect' function to browse the available -operations in a WSDL document." +operations in a WSDL document. + +NOTE: `soap-invoke' base64-decodes xsd:base64Binary return values +into unibyte strings; these byte-strings require further +interpretation by the caller." (apply #'soap-invoke-internal nil nil wsdl service operation-name parameters)) (defun soap-invoke-async (callback cbargs wsdl service operation-name