commit 1e19ee781bf6aae4da32845acc6603d07a2d9c3c (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Mon Sep 30 10:49:50 2019 +0300 Improve description of face merging * doc/lispref/display.texi (Displaying Faces): More accurate description of merging face attributes of "underlying text". (Bug#1222) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index fd6820897f..64b24f712a 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -2949,11 +2949,12 @@ For a header line, Emacs applies the @code{header-line} face. If the text comes from an overlay string via @code{before-string} or @code{after-string} properties (@pxref{Overlay Properties}), or from a display string (@pxref{Other Display Specs}), and the string doesn't -contain a @code{face} or @code{mouse-face} property, but the buffer -text affected by the overlay/display property does define a face, -Emacs applies the face attributes of the ``underlying'' buffer text. -Note that this is so even if the overlay or display string is -displayed in the display margins (@pxref{Display Margins}). +contain a @code{face} or @code{mouse-face} property, or these +properties leave some face attributes undefined, but the buffer text +affected by the overlay/display property does define a face or those +attributes, Emacs applies the face attributes of the ``underlying'' +buffer text. Note that this is so even if the overlay or display +string is displayed in the display margins (@pxref{Display Margins}). @item If any given attribute has not been specified during the preceding commit 13b9f6b6a06b5d8548ed2ee2f835605fefef0571 Author: Lars Ingebrigtsen Date: Mon Sep 30 08:57:45 2019 +0200 Make elisp- and emacs-index-search and default to the thing under point * lisp/menu-bar.el (elisp-index-search): Default to the thing under point interactively (bug#1119). (emacs-index-search): Ditto. (emacs-index--prompt): New helper function. diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 389234e975..19122125c5 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1761,15 +1761,28 @@ key, a click, or a menu-item")) (interactive) (info "(emacs)Glossary")) +(defun emacs-index--prompt () + (let* ((default (thing-at-point 'sexp)) + (topic + (read-from-minibuffer + (format "Subject to look up%s: " + (if default + (format " (default \"%s\")" default) + "")) + nil nil nil nil default))) + (list (if (zerop (length topic)) + default + topic)))) + (defun emacs-index-search (topic) "Look up TOPIC in the indices of the Emacs User Manual." - (interactive "sSubject to look up: ") + (interactive (emacs-index--prompt)) (info "emacs") (Info-index topic)) (defun elisp-index-search (topic) "Look up TOPIC in the indices of the Emacs Lisp Reference Manual." - (interactive "sSubject to look up: ") + (interactive (emacs-index--prompt)) (info "elisp") (Info-index topic)) commit 5d33839c3fc40308cd29dbd0991888ead81fbfa7 Author: Lars Ingebrigtsen Date: Mon Sep 30 08:41:43 2019 +0200 Refactor mm-decode and friends to be explicit about when errors happen * lisp/gnus/mm-decode.el (mm-sec-status): (mm-sec-error): New functions to handle decryption problems more explicitly (bug#18393). (mm-possibly-verify-or-decrypt): Use the `sec-error' data to determine whether the operation failed or not. * lisp/gnus/mml-smime.el: Ditto. * lisp/gnus/mml2015.el: Used throughout. diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 3de7a0464b..22e7e118e2 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -1646,14 +1646,22 @@ If RECURSIVE, search recursively." (setq result (buffer-string)))))) result)) -(defvar mm-security-handle nil) - (defsubst mm-set-handle-multipart-parameter (handle parameter value) ;; HANDLE could be a CTL. (when handle (put-text-property 0 (length (car handle)) parameter value (car handle)))) +;; Interface functions and variables for the decryption/verification +;; functions. +(defvar mm-security-handle nil) +(defun mm-sec-status (&rest keys) + (cl-loop for (key val) on keys by #'cddr + do (mm-set-handle-multipart-parameter mm-security-handle key val))) + +(defun mm-sec-error (&rest keys) + (apply #'mm-sec-status (append '(sec-error t) keys))) + (autoload 'mm-view-pkcs7 "mm-view") (defun mm-possibly-verify-or-decrypt (parts ctl &optional from) @@ -1706,9 +1714,8 @@ If RECURSIVE, search recursively." (save-excursion (if func (setq parts (funcall func parts ctl)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details - (format "Unknown sign protocol (%s)" protocol)))))) + (mm-sec-error 'gnus-details + (format "Unknown sign protocol (%s)" protocol)))))) ((equal subtype "encrypted") (unless (setq protocol (mm-handle-multipart-ctl-parameter ctl 'protocol)) @@ -1738,22 +1745,23 @@ If RECURSIVE, search recursively." (save-excursion (if func (setq parts (funcall func parts ctl)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details + (mm-sec-error + 'gnus-details (format "Unknown encrypt protocol (%s)" protocol))))))) ;; Check the results (which are now in `parts'). - (let ((info (get-text-property 0 'gnus-info (car mm-security-handle)))) - (if (or (not info) - (equal info "") - (not (equal subtype "encrypted")) - (member "OK" (split-string info "\n"))) + (let ((err (get-text-property 0 'sec-error (car mm-security-handle)))) + (if (or (not err) + (not (equal subtype "encrypted"))) parts ;; We had an error during decryption. Report what it is. (list (mm-make-handle (with-current-buffer (generate-new-buffer " *mm*") (insert "Error! Result from decryption:\n\n" - info "\n\n" + (or (get-text-property 0 'gnus-details + (car mm-security-handle)) + "") + "\n\n" (or (get-text-property 0 'gnus-details (car mm-security-handle)) "")) diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el index a00d64015f..6143b41bbc 100644 --- a/lisp/gnus/mm-uu.el +++ b/lisp/gnus/mm-uu.el @@ -509,8 +509,8 @@ apply the face `mm-uu-extract'." 'iso-8859-1))) (funcall (mml2015-clear-verify-function)))) (when (and mml2015-use (null (mml2015-clear-verify-function))) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details + (mml2015--status + 'gnus-details (format-message "Clear verification not supported by `%s'.\n" mml2015-use))) (mml2015-extract-cleartext-signature)) diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el index b2e9b78352..659f2b9528 100644 --- a/lisp/gnus/mml-smime.el +++ b/lisp/gnus/mml-smime.el @@ -274,10 +274,9 @@ Whether the passphrase is cached at all is controlled by (if (not good-signature) (progn ;; we couldn't verify message, fail with openssl output as message - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed") - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details + (mm-sec-error + 'gnus-info "Failed" + 'gnus-details (concat "OpenSSL failed to verify message integrity:\n" "-------------------------------------------\n" openssl-output))) @@ -290,19 +289,18 @@ Whether the passphrase is cached at all is controlled by (while (re-search-forward "-----END CERTIFICATE-----" nil t) (when (smime-pkcs7-email-region (point-min) (point)) (setq addresses (append (smime-buffer-as-string-region - (point-min) (point)) addresses))) + (point-min) (point)) + addresses))) (delete-region (point-min) (point))) (setq addresses (mapcar 'downcase addresses)))) - (if (not (member (downcase (or (mm-handle-multipart-from ctl) "")) addresses)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Sender address forged") + (if (not (member (downcase (or (mm-handle-multipart-from ctl) "")) + addresses)) + (mm-sec-error 'gnus-info "Sender address forged") (if good-certificate - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Ok (sender authenticated)") - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Ok (sender not trusted)"))) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details + (mm-sec-status 'gnus-info "Ok (sender authenticated)") + (mm-sec-status 'gnus-info "Ok (sender not trusted)"))) + (mm-sec-status + 'gnus-details (concat "Sender claimed to be: " (mm-handle-multipart-from ctl) "\n" (if addresses (concat "Addresses in certificate: " @@ -411,24 +409,20 @@ Content-Disposition: attachment; filename=smime.p7m (cdr handle) "application/x-pkcs7-signature" nil t))))) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Corrupted") + (mm-sec-error 'gnus-info "Corrupted") (throw 'error handle)) (setq part (replace-regexp-in-string "\n" "\r\n" part) context (epg-make-context 'CMS)) (condition-case error (setq plain (epg-verify-string context (mm-get-part signature) part)) (error - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed") + (mm-sec-error 'gnus-info "Failed") (if (eq (car error) 'quit) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details "Quit.") - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details (format "%S" error))) + (mm-sec-status 'gnus-details "Quit.") + (mm-sec-status 'gnus-details (format "%S" error))) (throw 'error handle))) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info + (mm-sec-status + 'gnus-info (epg-verify-result-to-string (epg-context-result-for context 'verify))) handle))) diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el index 45164ee8f6..c3cf31f1a3 100644 --- a/lisp/gnus/mml2015.el +++ b/lisp/gnus/mml2015.el @@ -191,8 +191,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (unless (setq child (mm-find-part-by-type (cdr handle) "application/octet-stream" nil t)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Corrupted") + (mm-sec-error 'gnus-info "Corrupted") (throw 'error handle)) (with-temp-buffer (mm-insert-part child) @@ -200,21 +199,18 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (condition-case err (funcall mml2015-decrypt-function) (error - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details (mml2015-format-error err)) + (mm-sec-error 'gnus-details (mml2015-format-error err)) nil) (quit - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details "Quit.") + (mm-sec-error 'gnus-details "Quit.") nil))) (unless (car result) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed") + (mm-sec-error 'gnus-info "Failed") (throw 'error handle)) (setq handles (mm-dissect-buffer t))) (mm-destroy-parts handle) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info + (mm-sec-status + 'gnus-info (concat "OK" (let ((sig (with-current-buffer mml2015-result-buffer (mml2015-gpg-extract-signature-details)))) @@ -281,18 +277,14 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (condition-case err (funcall mml2015-decrypt-function) (error - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details (mml2015-format-error err)) + (mm-sec-error 'gnus-details (mml2015-format-error err)) nil) (quit - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details "Quit.") + (mm-sec-error 'gnus-details "Quit.") nil))) (if (car result) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "OK") - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed")))) + (mm-sec-status 'gnus-info "OK") + (mm-sec-error 'gnus-info "Failed")))) (defun mml2015-fix-micalg (alg) (and alg @@ -309,8 +301,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." ctl 'protocol) "application/pgp-signature") t)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Corrupted") + (mm-sec-error 'gnus-info "Corrupted") (throw 'error handle)) (with-temp-buffer (insert "-----BEGIN PGP SIGNED MESSAGE-----\n") @@ -329,8 +320,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (forward-line))) (unless (setq part (mm-find-part-by-type (cdr handle) "application/pgp-signature" nil t)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Corrupted") + (mm-sec-error 'gnus-info "Corrupted") (throw 'error handle)) (save-restriction (narrow-to-region (point) (point)) @@ -345,8 +335,8 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (prog1 (funcall mml2015-verify-function) (if (get-buffer " *mailcrypt stderr temp") - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details + (mm-sec-error + 'gnus-details (with-current-buffer " *mailcrypt stderr temp" (buffer-string)))) (if (get-buffer " *mailcrypt stdout temp") @@ -358,18 +348,14 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (if (get-buffer mc-gpg-debug-buffer) (kill-buffer mc-gpg-debug-buffer))) (error - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details (mml2015-format-error err)) + (mm-sec-error 'gnus-details (mml2015-format-error err)) nil) (quit - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details "Quit.") + (mm-sec-error 'gnus-details "Quit.") nil)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed") + (mm-sec-error 'gnus-info "Failed") (throw 'error handle)))) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "OK") + (mm-sec-status 'gnus-info "OK") handle))) (defun mml2015-mailcrypt-clear-verify () @@ -378,8 +364,8 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (prog1 (funcall mml2015-verify-function) (if (get-buffer " *mailcrypt stderr temp") - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details + (mm-sec-error + 'gnus-details (with-current-buffer " *mailcrypt stderr temp" (buffer-string)))) (if (get-buffer " *mailcrypt stdout temp") @@ -391,17 +377,13 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (if (get-buffer mc-gpg-debug-buffer) (kill-buffer mc-gpg-debug-buffer))) (error - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details (mml2015-format-error err)) + (mm-sec-error 'gnus-details (mml2015-format-error err)) nil) (quit - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details "Quit.") + (mm-sec-error 'gnus-details "Quit.") nil)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "OK") - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed"))) + (mm-sec-status 'gnus-info "OK") + (mm-sec-error 'gnus-info "Failed"))) (mml2015-extract-cleartext-signature)) (defun mml2015-mailcrypt-sign (cont) @@ -509,8 +491,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (unless (setq child (mm-find-part-by-type (cdr handle) "application/octet-stream" nil t)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Corrupted") + (mm-sec-error 'gnus-info "Corrupted") (throw 'error handle)) (with-temp-buffer (mm-insert-part child) @@ -520,16 +501,12 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (setq decrypt-status (with-current-buffer mml2015-result-buffer (buffer-string))) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details - decrypt-status)) + (mm-sec-status 'gnus-details decrypt-status)) (error - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details (mml2015-format-error err)) + (mm-sec-error 'gnus-details (mml2015-format-error err)) nil) (quit - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details "Quit.") + (mm-sec-error 'gnus-details "Quit.") nil)) (with-current-buffer pgg-output-buffer (goto-char (point-min)) @@ -537,27 +514,24 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (replace-match "\n" t t)) (setq handles (mm-dissect-buffer t)) (mm-destroy-parts handle) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "OK") - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details - (concat decrypt-status - (when (stringp (car handles)) - "\n" (mm-handle-multipart-ctl-parameter - handles 'gnus-details)))) + (mm-sec-status 'gnus-info "OK" + 'gnus-details + (concat decrypt-status + (when (stringp (car handles)) + "\n" (mm-handle-multipart-ctl-parameter + handles 'gnus-details)))) (if (listp (car handles)) handles (list handles))) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed") + (mm-sec-error 'gnus-info "Failed") (throw 'error handle)))))) (defun mml2015-pgg-clear-decrypt () (let ((pgg-errors-buffer mml2015-result-buffer)) (if (prog1 (pgg-decrypt-region (point-min) (point-max)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details + (mm-sec-status + 'gnus-details (with-current-buffer mml2015-result-buffer (buffer-string)))) (progn @@ -568,10 +542,8 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (goto-char (point-min)) (while (search-forward "\r\n" nil t) (replace-match "\n" t t)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "OK")) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed")))) + (mm-sec-status 'gnus-info "OK")) + (mm-sec-error 'gnus-info "Failed")))) (defun mml2015-pgg-verify (handle ctl) (let ((pgg-errors-buffer mml2015-result-buffer) @@ -581,11 +553,11 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." ctl 'protocol) "application/pgp-signature") t))) - (null (setq signature (mm-find-part-by-type - (cdr handle) "application/pgp-signature" nil t)))) + (null (setq signature + (mm-find-part-by-type + (cdr handle) "application/pgp-signature" nil t)))) (progn - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Corrupted") + (mm-sec-error 'gnus-info "Corrupted") handle) (with-temp-buffer (insert part) @@ -607,29 +579,26 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (goto-char (point-min)) (while (search-forward "\r\n" nil t) (replace-match "\n" t t)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details + (mm-sec-status + 'gnus-details (concat (with-current-buffer pgg-output-buffer (buffer-string)) (with-current-buffer pgg-errors-buffer (buffer-string))))) (error - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details (mml2015-format-error err)) + (mm-sec-error 'gnus-details (mml2015-format-error err)) nil) (quit - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details "Quit.") + (mm-sec-error 'gnus-details "Quit.") nil)) (progn (delete-file signature-file) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info + (mm-sec-error + 'gnus-info (with-current-buffer pgg-errors-buffer (mml2015-gpg-extract-signature-details)))) (delete-file signature-file) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed"))))) + (mm-sec-error 'gnus-info "Failed"))))) handle) (defun mml2015-pgg-clear-verify () @@ -644,26 +613,23 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (goto-char (point-min)) (while (search-forward "\r\n" nil t) (replace-match "\n" t t)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details + (mm-sec-status + 'gnus-details (concat (with-current-buffer pgg-output-buffer (buffer-string)) (with-current-buffer pgg-errors-buffer (buffer-string))))) (error - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details (mml2015-format-error err)) + (mm-sec-error 'gnus-details (mml2015-format-error err)) nil) (quit - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details "Quit.") + (mm-sec-error 'gnus-details "Quit.") nil)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info + (mm-sec-status + 'gnus-info (with-current-buffer pgg-errors-buffer (mml2015-gpg-extract-signature-details))) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed"))) + (mm-sec-error 'gnus-info "Failed"))) (mml2015-extract-cleartext-signature)) (defun mml2015-pgg-sign (cont) @@ -807,8 +773,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (unless (setq child (mm-find-part-by-type (cdr handle) "application/octet-stream" nil t)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Corrupted") + (mm-sec-error 'gnus-info "Corrupted") (throw 'error handle)) (setq context (epg-make-context)) (if (or mml2015-cache-passphrase mml-secure-cache-passphrase) @@ -820,13 +785,10 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." mml-secure-secret-key-id-list nil) (error (mml-secure-clear-secret-key-id-list) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed") + (mm-sec-error 'gnus-info "Failed") (if (eq (car error) 'quit) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details "Quit.") - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details (mml2015-format-error error))) + (mm-sec-status 'gnus-details "Quit.") + (mm-sec-status 'gnus-details (mml2015-format-error error))) (throw 'error handle))) (with-temp-buffer (insert plain) @@ -836,16 +798,15 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (setq handles (mm-dissect-buffer t)) (mm-destroy-parts handle) (if (epg-context-result-for context 'verify) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info + (mm-sec-status + 'gnus-info (concat "OK\n" (mml2015-epg-verify-result-to-string (epg-context-result-for context 'verify)))) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "OK")) + (mm-sec-status 'gnus-info "OK")) (if (stringp (car handles)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details + (mm-sec-status + 'gnus-details (mm-handle-multipart-ctl-parameter handles 'gnus-details)))) (if (listp (car handles)) handles @@ -864,13 +825,10 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." mml-secure-secret-key-id-list nil) (error (mml-secure-clear-secret-key-id-list) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed") + (mm-sec-error 'gnus-info "Failed") (if (eq (car error) 'quit) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details "Quit.") - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details (mml2015-format-error error))))) + (mm-sec-status 'gnus-details "Quit.") + (mm-sec-status 'gnus-details (mml2015-format-error error))))) (when plain (erase-buffer) ;; Treat data which epg returns as a unibyte string. @@ -879,11 +837,10 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (goto-char (point-min)) (while (search-forward "\r\n" nil t) (replace-match "\n" t t)) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "OK") + (mm-sec-status 'gnus-info "OK") (if (epg-context-result-for context 'verify) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details + (mm-sec-status + 'gnus-details (mml2015-epg-verify-result-to-string (epg-context-result-for context 'verify))))))) @@ -899,8 +856,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (null (setq signature (mm-find-part-by-type (cdr handle) "application/pgp-signature" nil t)))) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Corrupted") + (mm-sec-error 'gnus-info "Corrupted") (throw 'error handle)) (setq part (replace-regexp-in-string "\n" "\r\n" part) signature (mm-get-part signature) @@ -908,16 +864,12 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (condition-case error (setq plain (epg-verify-string context signature part)) (error - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed") + (mm-sec-error 'gnus-info "Failed") (if (eq (car error) 'quit) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details "Quit.") - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details (mml2015-format-error error))) + (mm-sec-status 'gnus-details "Quit.") + (mm-sec-status 'gnus-details (mml2015-format-error error))) (throw 'error handle))) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info + (mm-sec-status 'gnus-info (mml2015-epg-verify-result-to-string (epg-context-result-for context 'verify))) handle))) @@ -931,17 +883,14 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (condition-case error (setq plain (epg-verify-string context signature)) (error - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info "Failed") + (mm-sec-error 'gnus-info "Failed") (if (eq (car error) 'quit) - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details "Quit.") - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-details (mml2015-format-error error))))) + (mm-sec-status 'gnus-details "Quit.") + (mm-sec-status 'gnus-details (mml2015-format-error error))))) (if plain (progn - (mm-set-handle-multipart-parameter - mm-security-handle 'gnus-info + (mm-sec-status + 'gnus-info (mml2015-epg-verify-result-to-string (epg-context-result-for context 'verify))) (delete-region (point-min) (point-max)) commit 542b78eddeba3f020349c2d02ba2d21e8613d99d Author: Lars Ingebrigtsen Date: Mon Sep 30 07:27:46 2019 +0200 Fix rendering of degenerate tables some more in shr.el * lisp/net/shr.el (shr--fix-tbody): New function (bug#31665). (shr--fix-table): Use it to fix the foo
case. diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 64263903bd..dc3cc38c79 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1993,8 +1993,16 @@ BASE is the URL of the HTML being rendered." `(tbody nil ,@(cl-reduce 'append (mapcar 'dom-non-text-children tbodies))))))) +(defun shr--fix-tbody (tbody) + (nconc (list 'tbody (dom-attributes tbody)) + (cl-loop for child in (dom-children tbody) + collect (if (or (stringp child) + (not (eq (dom-tag child) 'tr))) + (list 'tr nil (list 'td nil child)) + child)))) + (defun shr--fix-table (dom caption header footer) - (let* ((body (dom-non-text-children (shr-table-body dom))) + (let* ((body (dom-non-text-children (shr--fix-tbody (shr-table-body dom)))) (nheader (if header (shr-max-columns header))) (nbody (if body (shr-max-columns body) 0)) (nfooter (if footer (shr-max-columns footer)))) commit 9f9dca57c60033e6f3248f1492178fed57f3b552 Author: Lars Ingebrigtsen Date: Mon Sep 30 07:17:12 2019 +0200 shr table fix refactoring * lisp/net/shr.el (shr--fix-table): Refactor out into own function from... (shr-tag-table): ... this function. diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 0cd15dcfe0..64263903bd 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1993,19 +1993,75 @@ BASE is the URL of the HTML being rendered." `(tbody nil ,@(cl-reduce 'append (mapcar 'dom-non-text-children tbodies))))))) +(defun shr--fix-table (dom caption header footer) + (let* ((body (dom-non-text-children (shr-table-body dom))) + (nheader (if header (shr-max-columns header))) + (nbody (if body (shr-max-columns body) 0)) + (nfooter (if footer (shr-max-columns footer)))) + (nconc + (list 'table nil) + (if caption `((tr nil (td nil ,@caption)))) + (cond + (header + (if footer + ;; header + body + footer + (if (= nheader nbody) + (if (= nbody nfooter) + `((tr nil (td nil (table nil + (tbody nil ,@header + ,@body ,@footer))))) + (nconc `((tr nil (td nil (table nil + (tbody nil ,@header + ,@body))))) + (if (= nfooter 1) + footer + `((tr nil (td nil (table + nil (tbody + nil ,@footer)))))))) + (nconc `((tr nil (td nil (table nil (tbody + nil ,@header))))) + (if (= nbody nfooter) + `((tr nil (td nil (table + nil (tbody nil ,@body + ,@footer))))) + (nconc `((tr nil (td nil (table + nil (tbody nil + ,@body))))) + (if (= nfooter 1) + footer + `((tr nil (td nil (table + nil + (tbody + nil + ,@footer)))))))))) + ;; header + body + (if (= nheader nbody) + `((tr nil (td nil (table nil (tbody nil ,@header + ,@body))))) + (if (= nheader 1) + `(,@header (tr nil (td nil (table + nil (tbody nil ,@body))))) + `((tr nil (td nil (table nil (tbody nil ,@header)))) + (tr nil (td nil (table nil (tbody nil ,@body))))))))) + (footer + ;; body + footer + (if (= nbody nfooter) + `((tr nil (td nil (table + nil (tbody nil ,@body ,@footer))))) + (nconc `((tr nil (td nil (table nil (tbody nil ,@body))))) + (if (= nfooter 1) + footer + `((tr nil (td nil (table + nil (tbody nil ,@footer))))))))) + (caption + `((tr nil (td nil (table nil (tbody nil ,@body)))))) + (body))))) + (defun shr-tag-table (dom) (shr-ensure-paragraph) (let* ((caption (dom-children (dom-child-by-tag dom 'caption))) (header (dom-non-text-children (dom-child-by-tag dom 'thead))) - (body (dom-non-text-children (shr-table-body dom))) - (footer (dom-non-text-children (dom-child-by-tag dom 'tfoot))) - (bgcolor (dom-attr dom 'bgcolor)) - (start (point)) - (shr-stylesheet (nconc (list (cons 'background-color bgcolor)) - shr-stylesheet)) - (nheader (if header (shr-max-columns header))) - (nbody (if body (shr-max-columns body) 0)) - (nfooter (if footer (shr-max-columns footer)))) + (footer (dom-non-text-children (dom-child-by-tag dom 'tfoot)))) (if (and (not caption) (not header) (not (dom-child-by-tag dom 'tbody)) @@ -2018,83 +2074,29 @@ BASE is the URL of the HTML being rendered." (if (dom-attr dom 'shr-fixed-table) (shr-tag-table-1 dom) ;; Only fix up the table once. - (let ((table - (nconc - (list 'table nil) - (if caption `((tr nil (td nil ,@caption)))) - (cond - (header - (if footer - ;; header + body + footer - (if (= nheader nbody) - (if (= nbody nfooter) - `((tr nil (td nil (table nil - (tbody nil ,@header - ,@body ,@footer))))) - (nconc `((tr nil (td nil (table nil - (tbody nil ,@header - ,@body))))) - (if (= nfooter 1) - footer - `((tr nil (td nil (table - nil (tbody - nil ,@footer)))))))) - (nconc `((tr nil (td nil (table nil (tbody - nil ,@header))))) - (if (= nbody nfooter) - `((tr nil (td nil (table - nil (tbody nil ,@body - ,@footer))))) - (nconc `((tr nil (td nil (table - nil (tbody nil - ,@body))))) - (if (= nfooter 1) - footer - `((tr nil (td nil (table - nil - (tbody - nil - ,@footer)))))))))) - ;; header + body - (if (= nheader nbody) - `((tr nil (td nil (table nil (tbody nil ,@header - ,@body))))) - (if (= nheader 1) - `(,@header (tr nil (td nil (table - nil (tbody nil ,@body))))) - `((tr nil (td nil (table nil (tbody nil ,@header)))) - (tr nil (td nil (table nil (tbody nil ,@body))))))))) - (footer - ;; body + footer - (if (= nbody nfooter) - `((tr nil (td nil (table - nil (tbody nil ,@body ,@footer))))) - (nconc `((tr nil (td nil (table nil (tbody nil ,@body))))) - (if (= nfooter 1) - footer - `((tr nil (td nil (table - nil (tbody nil ,@footer))))))))) - (caption - `((tr nil (td nil (table nil (tbody nil ,@body)))))) - (body))))) + (let ((table (shr--fix-table dom caption header footer))) (dom-set-attribute table 'shr-fixed-table t) (setcdr dom (cdr table)) - (shr-tag-table-1 dom)))) - (when bgcolor - (shr-colorize-region start (point) (cdr (assq 'color shr-stylesheet)) - bgcolor)) - ;; Finally, insert all the images after the table. The Emacs buffer - ;; model isn't strong enough to allow us to put the images actually - ;; into the tables. It inserts also non-td/th objects. - (when (zerop shr-table-depth) - (save-excursion - (shr-expand-alignments start (point))) - (let ((strings (shr-collect-extra-strings-in-table dom))) - (when strings - (save-restriction - (narrow-to-region (point) (point)) - (insert (mapconcat #'identity strings "\n")) - (shr-fill-lines (point-min) (point-max)))))))) + (shr-tag-table-1 dom))) + (let* ((bgcolor (dom-attr dom 'bgcolor)) + (start (point)) + (shr-stylesheet (nconc (list (cons 'background-color bgcolor)) + shr-stylesheet))) + (when bgcolor + (shr-colorize-region start (point) (cdr (assq 'color shr-stylesheet)) + bgcolor)) + ;; Finally, insert all the images after the table. The Emacs buffer + ;; model isn't strong enough to allow us to put the images actually + ;; into the tables. It inserts also non-td/th objects. + (when (zerop shr-table-depth) + (save-excursion + (shr-expand-alignments start (point))) + (let ((strings (shr-collect-extra-strings-in-table dom))) + (when strings + (save-restriction + (narrow-to-region (point) (point)) + (insert (mapconcat #'identity strings "\n")) + (shr-fill-lines (point-min) (point-max)))))))))) (defun shr-collect-extra-strings-in-table (dom &optional flags) "Return extra strings in DOM of which the root is a table clause. commit 150bf03107791cd413fa635665401a808b015b4f Author: Lars Ingebrigtsen Date: Mon Sep 30 06:29:27 2019 +0200 Change the commands in image-converter--converters to lists * lisp/image/image-converter.el (image-converter--converters): Change format of the commands to lists. (image-converter--probe, image-converter--convert): Adjust usages. diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el index e91d87af40..f251d5ca59 100644 --- a/lisp/image/image-converter.el +++ b/lisp/image/image-converter.el @@ -43,9 +43,9 @@ installed on the system." "A regexp that matches the file name suffixes that can be converted.") (defvar image-converter--converters - '((graphicsmagick :command "gm convert" :probe "-list format") + '((graphicsmagick :command ("gm" "convert") :probe ("-list" "format")) (ffmpeg :command "ffmpeg" :probe "-decoders") - (imagemagick :command "convert" :probe "-list format")) + (imagemagick :command "convert" :probe ("-list" "format"))) "List of supported image converters to try.") (defun image-convert-p (file) @@ -90,17 +90,19 @@ where created with DATA-P nil (i.e., it has to refer to a file)." (defun image-converter--value (type elem) "Return the value of ELEM of image converter TYPE." - (plist-get (cdr (assq type image-converter--converters)) elem)) + (let ((value (plist-get (cdr (assq type image-converter--converters)) elem))) + (if (stringp value) + (list value) + value))) (cl-defmethod image-converter--probe ((type (eql graphicsmagick))) "Check whether the system has GraphicsMagick installed." (with-temp-buffer - (let ((command (split-string (image-converter--value type :command) " ")) + (let ((command (image-converter--value type :command)) formats) (when (zerop (apply #'call-process (car command) nil '(t nil) nil (append (cdr command) - (split-string - (image-converter--value type :probe) " ")))) + (image-converter--value type :probe)))) (goto-char (point-min)) (when (re-search-forward "^-" nil t) (forward-line 1) @@ -113,13 +115,12 @@ where created with DATA-P nil (i.e., it has to refer to a file)." (cl-defmethod image-converter--probe ((type (eql imagemagick))) "Check whether the system has ImageMagick installed." (with-temp-buffer - (let ((command (split-string (image-converter--value type :command) " ")) + (let ((command (image-converter--value type :command)) formats) ;; Can't check return value; ImageMagick convert usually returns ;; a non-zero result on "-list format". (apply #'call-process (car command) nil '(t nil) nil - (append (cdr command) - (split-string (image-converter--value type :probe) " "))) + (append (cdr command) (image-converter--value type :probe))) (goto-char (point-min)) (when (re-search-forward "^-" nil t) (forward-line 1) @@ -134,8 +135,9 @@ where created with DATA-P nil (i.e., it has to refer to a file)." (with-temp-buffer (let ((command (image-converter--value type :command)) formats) - (when (zerop (call-process command nil '(t nil) nil - (image-converter--value type :probe))) + (when (zerop (apply #'call-process (car command) nil '(t nil) nil + (append (cdr command) + (image-converter--value type :probe)))) (goto-char (point-min)) (when (re-search-forward "^ *-" nil t) (forward-line 1) @@ -161,7 +163,7 @@ where created with DATA-P nil (i.e., it has to refer to a file)." (image-converter--convert-magick type file)) (defun image-converter--convert-magick (type file) - (let ((command (split-string (image-converter--value type :command) " "))) + (let ((command (image-converter--value type :command))) (unless (zerop (apply #'call-process (car command) nil t nil (append (cdr command) @@ -172,11 +174,14 @@ where created with DATA-P nil (i.e., it has to refer to a file)." (cl-defmethod image-converter--convert ((type (eql ffmpeg)) file) "Convert using ffmpeg." - (unless (zerop (call-process (image-converter--value type :command) - nil '(t nil) nil - "-i" (expand-file-name file) - "-c:v" "png" "-f" "image2pipe" "-")) - "ffmpeg error when converting")) + (let ((command (image-converter--value type :command))) + (unless (zerop (apply #'call-process + (car command) + nil '(t nil) nil + (append (cdr command) + (list "-i" (expand-file-name file) + "-c:v" "png" "-f" "image2pipe" "-")))) + "ffmpeg error when converting"))) (provide 'image-converter) commit 88250102707799bf961c3f1a3d80607b99502704 Author: Lars Ingebrigtsen Date: Mon Sep 30 06:00:52 2019 +0200 Rename the new convert-images-externally variable * doc/emacs/files.texi (File Conveniences): Adjust documentation. * lisp/image.el (image-use-external-converter): Rename from convert-images-externally. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 35ba30adb3..0ff64d529c 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -2161,9 +2161,9 @@ never be rendered using ImageMagick, regardless of the value of but Emacs should not). To disable ImageMagick entirely, change @code{imagemagick-types-inhibit} to @code{t}. -@vindex convert-images-externally +@vindex image-use-external-converter If Emacs doesn't have native support for the image format in -question, and @code{convert-images-externally} is non-@code{nil}, +question, and @code{image-use-external-converter} is non-@code{nil}, Emacs will try to determine whether there are external utilities that can be used to transform the image in question to @acronym{PNG} before displaying. GraphicsMagick, ImageMagick and @command{ffmpeg} are diff --git a/lisp/image.el b/lisp/image.el index 07ffefcbc5..eaa6ed3b0e 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -141,7 +141,7 @@ based on the font pixel size." (const :tag "Automatically compute" auto)) :version "26.1") -(defcustom convert-images-externally nil +(defcustom image-use-external-converter nil "If non-nil, `create-image' will use external converters for exotic formats. Emacs handles most of the common image formats (SVG, JPEG, PNG, GIF and some others) internally, but images that don't have native @@ -386,7 +386,7 @@ Optional DATA-P non-nil means SOURCE is a string containing image data." (image-type-from-data source) (or (image-type-from-file-header source) (image-type-from-file-name source) - (and convert-images-externally + (and image-use-external-converter (progn (require 'image-converter) (image-convert-p source)))))) commit fd887250dc560541ecc2a3ea4a5d6f61591e2821 Author: Juanma Barranquero Date: Mon Sep 30 03:31:53 2019 +0200 Silence byte-compiler warning * lisp/obsolete/info-edit.el (ibuffer-help-buffer-modes): Defvar it. diff --git a/lisp/obsolete/info-edit.el b/lisp/obsolete/info-edit.el index 55c52b5abd..b71af889a0 100644 --- a/lisp/obsolete/info-edit.el +++ b/lisp/obsolete/info-edit.el @@ -78,6 +78,7 @@ This feature will be removed in future.") (buffer-modified-p) (message "Tags may have changed. Use Info-tagify if necessary"))) +(defvar ibuffer-help-buffer-modes) ;; Moved here from definition of ibuffer-help-buffer-modes to make ;; that variable customizable even though this code is obsolete. See ;; also Bug#30990. commit 6ade75a20408419a13c57804bc9bc232ea615a1f Author: Stefan Kangas Date: Mon Sep 30 00:42:47 2019 +0200 * lisp/dired-x.el (dired-virtual): Fix typo. diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 313a22725c..63eb028717 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -661,7 +661,7 @@ visit that file and turn on Virtual Dired mode. But don't try to save this file, as dired-virtual indents the listing and thus changes the buffer. -If you have save a Dired buffer in a file you can use \\[dired-virtual] to +If you have saved a Dired buffer in a file you can use \\[dired-virtual] to resume it in a later session. Type \\\\[revert-buffer] \ commit 524af9b8334387a17ed890c96355e4adb3f12122 Author: Stefan Monnier Date: Sun Sep 29 18:15:56 2019 -0400 * lisp/nxml/rng-valid.el: Use define-minor-mode Remove redundant `:group`s. (rng-validate-mode): Use define-minor-mode. (rng-validate-clear): Let-bind rng-current-schema instead of passing a `no-change-schema` argument. diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el index 6c1ca517b8..8cffbc3a7a 100644 --- a/lisp/nxml/rng-valid.el +++ b/lisp/nxml/rng-valid.el @@ -106,34 +106,29 @@ :group 'languages) (defface rng-error '((t (:inherit font-lock-warning-face))) - "Face for highlighting XML errors." - :group 'relax-ng) + "Face for highlighting XML errors.") (defcustom rng-state-cache-distance 2000 "Distance in characters between each parsing and validation state cache." - :type 'integer - :group 'relax-ng) + :type 'integer) (defcustom rng-validate-chunk-size 8000 "Number of characters in a RELAX NG validation chunk. A validation chunk will be the smallest chunk that is at least this size and ends with a tag. After validating a chunk, validation will continue only if Emacs is still idle." - :type 'integer - :group 'relax-ng) + :type 'integer) (defcustom rng-validate-delay 1.5 "Time in seconds that Emacs must be idle before starting a full validation. A full validation continues until either validation is up to date or Emacs is no longer idle." - :type 'number - :group 'relax-ng) + :type 'number) (defcustom rng-validate-quick-delay 0.3 "Time in seconds that Emacs must be idle before starting a quick validation. A quick validation validates at most one chunk." - :type 'number - :group 'relax-ng) + :type 'number) ;; Global variables @@ -208,14 +203,11 @@ See the variable `rng-conditional-up-to-date-start'.") "Non-nil means we are currently parsing just to compute the state. Should be dynamically bound.") -(defvar rng-validate-mode nil) -(make-variable-buffer-local 'rng-validate-mode) - (defvar rng-dtd nil) (make-variable-buffer-local 'rng-dtd) ;;;###autoload -(defun rng-validate-mode (&optional arg no-change-schema) +(define-minor-mode rng-validate-mode "Minor mode performing continual validation against a RELAX NG schema. Checks whether the buffer is a well-formed XML 1.0 document, @@ -237,11 +229,7 @@ be a RELAX NG schema using the compact schema \(such schemas conventionally have a suffix of `.rnc'). The variable `rng-schema-locating-files' specifies files containing rules to use for finding the schema." - (interactive "P") - (setq rng-validate-mode - (if (null arg) - (not rng-validate-mode) - (> (prefix-numeric-value arg) 0))) + :global nil (save-restriction (widen) (with-silent-modifications @@ -252,21 +240,20 @@ to use for finding the schema." (rng-clear-conditional-region) (setq rng-error-count 0) ;; do this here to avoid infinite loop if we set the schema - (remove-hook 'rng-schema-change-hook 'rng-validate-clear t) + (remove-hook 'rng-schema-change-hook #'rng-validate-clear t) (cond (rng-validate-mode (unwind-protect (save-excursion ;; An error can change the current buffer (when (or (not rng-current-schema) - (and (eq rng-current-schema rng-any-element) - (not no-change-schema))) + (eq rng-current-schema rng-any-element)) (rng-auto-set-schema t))) (unless rng-current-schema (rng-set-schema-file-1 nil)) - (add-hook 'rng-schema-change-hook 'rng-validate-clear nil t) - (add-hook 'after-change-functions 'rng-after-change-function nil t) - (add-hook 'kill-buffer-hook 'rng-kill-timers nil t) - (add-hook 'echo-area-clear-hook 'rng-echo-area-clear-function nil t) - (add-hook 'post-command-hook 'rng-maybe-echo-error-at-point nil t) + (add-hook 'rng-schema-change-hook #'rng-validate-clear nil t) + (add-hook 'after-change-functions #'rng-after-change-function nil t) + (add-hook 'kill-buffer-hook #'rng-kill-timers nil t) + (add-hook 'echo-area-clear-hook #'rng-echo-area-clear-function nil t) + (add-hook 'post-command-hook #'rng-maybe-echo-error-at-point nil t) (rng-match-init-buffer) (rng-activate-timers) ;; Start validating right away if the buffer is visible. @@ -278,11 +265,10 @@ to use for finding the schema." (rng-validate-while-idle (current-buffer))))) (t (rng-cancel-timers) - (force-mode-line-update) - (remove-hook 'kill-buffer-hook 'rng-cancel-timers t) - (remove-hook 'post-command-hook 'rng-maybe-echo-error-at-point t) - (remove-hook 'echo-area-clear-hook 'rng-echo-area-clear-function t) - (remove-hook 'after-change-functions 'rng-after-change-function t)))) + (remove-hook 'kill-buffer-hook #'rng-cancel-timers t) + (remove-hook 'post-command-hook #'rng-maybe-echo-error-at-point t) + (remove-hook 'echo-area-clear-hook #'rng-echo-area-clear-function t) + (remove-hook 'after-change-functions #'rng-after-change-function t)))) (defun rng-set-schema-file-and-validate (filename) "Sets the schema and turns on `rng-validate-mode' if not already on. @@ -389,16 +375,20 @@ The schema is set like `rng-auto-set-schema'." (setq rng-validate-timer (run-with-idle-timer rng-validate-delay t - 'rng-validate-while-idle + #'rng-validate-while-idle (current-buffer))) (setq rng-validate-quick-timer (run-with-idle-timer rng-validate-quick-delay t - 'rng-validate-quick-while-idle + #'rng-validate-quick-while-idle (current-buffer)))))) (defun rng-validate-clear () - (rng-validate-mode 1 t)) + (if (eq rng-current-schema rng-any-element) + ;; Prevent rng-validate-mode from trying to find another schema. + (let ((rng-current-schema (copy-sequence rng-current-schema))) + (rng-validate-mode)) + (rng-validate-mode))) ;; These two variables are dynamically bound and used ;; to pass information between rng-validate-while-idle @@ -432,7 +422,7 @@ The schema is set like `rng-auto-set-schema'." (if rng-validate-mode (if (let ((rng-validate-display-point (point)) (rng-validate-display-modified-p (buffer-modified-p))) - (rng-do-some-validation 'rng-validate-while-idle-continue-p)) + (rng-do-some-validation #'rng-validate-while-idle-continue-p)) (force-mode-line-update) (rng-validate-done)) ;; Must have done kill-all-local-variables. @@ -1109,7 +1099,7 @@ as empty-element." (defun rng-mark-start-tag-close (&rest args) (when (not (eq xmltok-type 'partial-start-tag)) - (rng-mark-invalid (apply 'format args) + (rng-mark-invalid (apply #'format args) (- (point) (if (eq xmltok-type 'empty-element) 2 @@ -1285,19 +1275,19 @@ as empty-element." ((memq nil contents) nil) ((not (cdr contents)) (rng-segment-string (car contents))) - (t (apply 'concat - (nreverse (mapcar 'rng-segment-string + (t (apply #'concat + (nreverse (mapcar #'rng-segment-string contents))))))) (defun rng-segment-string (segment) (or (car segment) - (apply 'buffer-substring-no-properties + (apply #'buffer-substring-no-properties (cdr segment)))) (defun rng-segment-blank-p (segment) (if (car segment) (rng-blank-p (car segment)) - (apply 'rng-region-blank-p + (apply #'rng-region-blank-p (cdr segment)))) (defun rng-contents-region () commit a4688030b4be6e7ef71b6c58c3051fa4bd399d33 Author: Tom Willemse Date: Mon Oct 12 00:45:49 2015 +0200 Fix indenting in perl functions with doc-comments * lisp/progmodes/perl-mode.el (perl-calculate-indent): Skip doc-comments as well as comments and skip the entire comment, not just the line. (Bug#21647) diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index 55ea3417ff..ab3680bfb7 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -1007,8 +1007,8 @@ Returns (parse-state) if line starts inside a string." ;; Skip over comments and labels following openbrace. (while (progn (skip-chars-forward " \t\f\n") - (cond ((looking-at ";?#") - (forward-line 1) t) + (cond ((looking-at ";?#\\|^=\\w+") + (forward-comment 1) t) ((looking-at "\\(\\w\\|\\s_\\)+:[^:]") (setq colon-line-end (line-end-position)) (search-forward ":"))))) commit c34801f8838c4b91378c3e0d961aca826a923e95 Author: Lars Ingebrigtsen Date: Sun Sep 29 21:57:59 2019 +0200 Update iso8601-tests for new interface diff --git a/test/lisp/calendar/iso8601-tests.el b/test/lisp/calendar/iso8601-tests.el index 1d44e947a7..b5a3c9538d 100644 --- a/test/lisp/calendar/iso8601-tests.el +++ b/test/lisp/calendar/iso8601-tests.el @@ -154,23 +154,23 @@ '(0 0 15 nil nil nil nil nil nil)))) (ert-deftest standard-test-time-of-day-fractions () - (should (equal (iso8601-parse-time "152735,5") + (should (equal (iso8601-parse-time "152735,5" t) '((355 . 10) 27 15 nil nil nil nil nil nil))) - (should (equal (iso8601-parse-time "15:27:35,5") + (should (equal (iso8601-parse-time "15:27:35,5" t) '((355 . 10) 27 15 nil nil nil nil nil nil))) - (should (equal (iso8601-parse-time "2320,5") + (should (equal (iso8601-parse-time "2320,5" t) '(30 20 23 nil nil nil nil nil nil))) - (should (equal (iso8601-parse-time "23:20,8") + (should (equal (iso8601-parse-time "23:20,8" t) '(48 20 23 nil nil nil nil nil nil))) - (should (equal (iso8601-parse-time "23,3") + (should (equal (iso8601-parse-time "23,3" t) '(0 18 23 nil nil nil nil nil nil)))) (ert-deftest nonstandard-test-time-of-day-decimals () - (should (equal (iso8601-parse-time "15:27:35.123") + (should (equal (iso8601-parse-time "15:27:35.123" t) '((35123 . 1000) 27 15 nil nil nil nil nil nil))) - (should (equal (iso8601-parse-time "15:27:35.123456789") + (should (equal (iso8601-parse-time "15:27:35.123456789" t) '((35123456789 . 1000000000) 27 15 nil nil nil nil nil nil)))) (ert-deftest standard-test-time-of-day-beginning-of-day () commit e68fa34d62edb62d58f1280a84c2f45d25a33423 Author: Lars Ingebrigtsen Date: Sun Sep 29 21:55:20 2019 +0200 Make iso8601-parse take a FORM parameter like `decode-time' * lisp/calendar/iso8601.el (iso8601-parse-time, iso8601-parse): Take a FORM parameter like `decode-time'. diff --git a/lisp/calendar/iso8601.el b/lisp/calendar/iso8601.el index 66446dafb9..3ff91d910c 100644 --- a/lisp/calendar/iso8601.el +++ b/lisp/calendar/iso8601.el @@ -111,7 +111,7 @@ iso8601--duration-week-match iso8601--duration-combined-match))) -(defun iso8601-parse (string) +(defun iso8601-parse (string &optional form) "Parse an ISO 8601 date/time string and return a `decode-time' structure. The ISO 8601 date/time strings look like \"2008-03-02T13:47:30\", @@ -119,9 +119,7 @@ but shorter, incomplete strings like \"2008-03-02\" are valid, as well as variants like \"2008W32\" (week number) and \"2008-234\" (ordinal day number). -The `decode-time' value returned will have the same precision as -STRING, so if a sub-second STRING is passed in, the `decode-time' -seconds field will be on the (SECONDS . HZ) format." +See `decode-time' for the meaning of FORM." (if (not (iso8601-valid-p string)) (signal 'wrong-type-argument string) (let* ((date-string (match-string 1 string)) @@ -130,7 +128,7 @@ seconds field will be on the (SECONDS . HZ) format." (date (iso8601-parse-date date-string))) ;; The time portion is optional. (when time-string - (let ((time (iso8601-parse-time time-string))) + (let ((time (iso8601-parse-time time-string form))) (setf (decoded-time-hour date) (decoded-time-hour time)) (setf (decoded-time-minute date) (decoded-time-minute time)) (setf (decoded-time-second date) (decoded-time-second time)))) @@ -221,10 +219,12 @@ seconds field will be on the (SECONDS . HZ) format." (1- (- year)) year)))) -(defun iso8601-parse-time (string) +(defun iso8601-parse-time (string &optional form) "Parse STRING, which should be an ISO 8601 time string. The return value will be a `decode-time' structure with just the -hour/minute/seconds/zone fields filled in." +hour/minute/seconds/zone fields filled in. + +See `decode-time' for the meaning of FORM." (if (not (iso8601--match iso8601--full-time-match string)) (signal 'wrong-type-argument string) (let ((time (match-string 1 string)) @@ -238,7 +238,8 @@ hour/minute/seconds/zone fields filled in." (string-to-number (match-string 3 time)))) (fraction (and (match-string 4 time) (string-to-number (match-string 4 time))))) - (when fraction + (when (and fraction + (eq form t)) (cond ;; Sub-second time. (second commit 0df01e3aa5f8372995bdc39be36c444c54a52f7e Author: Lars Ingebrigtsen Date: Sun Sep 29 21:22:29 2019 +0200 Add support for sub-second ISO8601 strings * lisp/calendar/iso8601.el (iso8601--decimalize): New function. (iso8601-parse-time): Support sub-second ISO8601 times. diff --git a/lisp/calendar/iso8601.el b/lisp/calendar/iso8601.el index f8949914f7..66446dafb9 100644 --- a/lisp/calendar/iso8601.el +++ b/lisp/calendar/iso8601.el @@ -112,12 +112,16 @@ iso8601--duration-combined-match))) (defun iso8601-parse (string) - "Parse an ISO 8601 date/time string and return a `decoded-time' structure. + "Parse an ISO 8601 date/time string and return a `decode-time' structure. The ISO 8601 date/time strings look like \"2008-03-02T13:47:30\", but shorter, incomplete strings like \"2008-03-02\" are valid, as well as variants like \"2008W32\" (week number) and -\"2008-234\" (ordinal day number)." +\"2008-234\" (ordinal day number). + +The `decode-time' value returned will have the same precision as +STRING, so if a sub-second STRING is passed in, the `decode-time' +seconds field will be on the (SECONDS . HZ) format." (if (not (iso8601-valid-p string)) (signal 'wrong-type-argument string) (let* ((date-string (match-string 1 string)) @@ -138,7 +142,7 @@ well as variants like \"2008W32\" (week number) and date))) (defun iso8601-parse-date (string) - "Parse STRING (in ISO 8601 format) and return a decoded time value." + "Parse STRING (in ISO 8601 format) and return a `decode-time' value." (cond ;; Just a year: [-+]YYYY. ((iso8601--match iso8601--year-match string) @@ -218,7 +222,9 @@ well as variants like \"2008W32\" (week number) and year)))) (defun iso8601-parse-time (string) - "Parse STRING, which should be an ISO 8601 time string, and return a time value." + "Parse STRING, which should be an ISO 8601 time string. +The return value will be a `decode-time' structure with just the +hour/minute/seconds/zone fields filled in." (if (not (iso8601--match iso8601--full-time-match string)) (signal 'wrong-type-argument string) (let ((time (match-string 1 string)) @@ -230,9 +236,22 @@ well as variants like \"2008W32\" (week number) and (string-to-number (match-string 2 time)))) (second (and (match-string 3 time) (string-to-number (match-string 3 time)))) - ;; Hm... - (_millisecond (and (match-string 4 time) + (fraction (and (match-string 4 time) (string-to-number (match-string 4 time))))) + (when fraction + (cond + ;; Sub-second time. + (second + (let ((digits (1+ (truncate (log fraction 10))))) + (setq second (cons (+ (* second (expt 10 digits)) + fraction) + (expt 10 digits))))) + ;; Fractional minute. + (minute + (setq second (iso8601--decimalize fraction 60))) + (hour + ;; Fractional hour. + (setq minute (iso8601--decimalize fraction 60))))) (iso8601--decoded-time :hour hour :minute (or minute 0) :second (or second 0) @@ -240,6 +259,10 @@ well as variants like \"2008W32\" (week number) and (* 60 (iso8601-parse-zone zone))))))))) +(defun iso8601--decimalize (fraction base) + (round (* base (/ (float fraction) + (expt 10 (1+ (truncate (log fraction 10)))))))) + (defun iso8601-parse-zone (string) "Parse STRING, which should be an ISO 8601 time zone. Return the number of minutes." diff --git a/test/lisp/calendar/iso8601-tests.el b/test/lisp/calendar/iso8601-tests.el index 8d2aec3de5..1d44e947a7 100644 --- a/test/lisp/calendar/iso8601-tests.el +++ b/test/lisp/calendar/iso8601-tests.el @@ -153,25 +153,25 @@ (should (equal (iso8601-parse-time "15") '(0 0 15 nil nil nil nil nil nil)))) -;; Not implemented yet. - -;; (ert-deftest standard-test-time-of-day-fractions () -;; (should (equal (iso8601-parse-time "152735,5") -;; '(46 27 15 nil nil nil nil nil nil))) -;; (should (equal (iso8601-parse-time "15:27:35,5") -;; '(46 27 15 nil nil nil nil nil nil))) - -;; (should (equal (iso8601-parse-time "2320,8") -;; '(46 27 15 nil nil nil nil nil nil))) -;; (should (equal (iso8601-parse-time "23:20,8") -;; '(46 27 15 nil nil nil nil nil nil))) - -;; (should (equal (iso8601-parse-time "23,3") -;; '(46 27 15 nil nil nil nil nil nil)))) - -;; (ert-deftest nonstandard-test-time-of-day-decimals () -;; (should (equal (iso8601-parse-time "15:27:35.123") -;; '(46 27 15 nil nil nil nil nil nil)))) +(ert-deftest standard-test-time-of-day-fractions () + (should (equal (iso8601-parse-time "152735,5") + '((355 . 10) 27 15 nil nil nil nil nil nil))) + (should (equal (iso8601-parse-time "15:27:35,5") + '((355 . 10) 27 15 nil nil nil nil nil nil))) + + (should (equal (iso8601-parse-time "2320,5") + '(30 20 23 nil nil nil nil nil nil))) + (should (equal (iso8601-parse-time "23:20,8") + '(48 20 23 nil nil nil nil nil nil))) + + (should (equal (iso8601-parse-time "23,3") + '(0 18 23 nil nil nil nil nil nil)))) + +(ert-deftest nonstandard-test-time-of-day-decimals () + (should (equal (iso8601-parse-time "15:27:35.123") + '((35123 . 1000) 27 15 nil nil nil nil nil nil))) + (should (equal (iso8601-parse-time "15:27:35.123456789") + '((35123456789 . 1000000000) 27 15 nil nil nil nil nil nil)))) (ert-deftest standard-test-time-of-day-beginning-of-day () (should (equal (iso8601-parse-time "000000") commit 53ebec24c871c5e6adb6aed088199d1b15e0198a Author: Paul Eggert Date: Sun Sep 29 13:11:59 2019 -0500 * src/timefns.c (Fdecode_time): Improve doc string. diff --git a/src/timefns.c b/src/timefns.c index c1e3141c4c..330d5623f0 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -1472,9 +1472,9 @@ the TZ environment variable. It can also be a list (as from without consideration for daylight saving time. The optional FORM specifies the form of the SEC member. If `integer', -SEC is an integer; if t, SEC uses the same resolution as TIME. An -omitted or nil FORM is currently treated like `integer', but this may -change in future Emacs versions. +SEC is an integer; if t, SEC is an integer or (TICKS . HZ) timestamp +with the same precision as TIME. An omitted or nil FORM is currently +treated like `integer', but this may change in future Emacs versions. To access (or alter) the elements in the time value, the `decoded-time-second', `decoded-time-minute', `decoded-time-hour', commit 18ba78e99b5324e6d689e1cb142a5616493bfebb Author: Stefan Kangas Date: Sun Sep 29 18:26:50 2019 +0200 Clarify recent ert manual change * doc/misc/ert.texi (Running Tests in Batch Mode): Say that ert test selector strings are regular expressions. diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 889216cbef..ee3725e5b2 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -339,7 +339,8 @@ In quiet mode ERT prints only unexpected results and summary. You can specify selectors to only run a subset of your tests (@pxref{Test Selectors}). For example, the following would run all -tests where the name of the test matches the string ``to-match''. +tests where the name of the test matches the regular expression +``to-match''. @example emacs -batch -l ert -l my-tests.el \ commit 53b71fd4adf6de6b4d8b37e8ab3d56eb93e7ce92 Author: Alan Mackenzie Date: Sun Sep 29 15:39:16 2019 +0000 Remove the compilation-arrow-overlay on a major mode change/reinitialization At the same time, remove the 2-character left margin. * lisp/progmodes/compile.el (compilation-set-up-arrow-spec-in-margin): put compilation-tear-down-arrow-spec-in-margin onto change-major-mode-hook. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index f0b34c702c..d80fef3103 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -2625,7 +2625,10 @@ Actual value is never used, only the text property.") (make-overlay overlay-arrow-position overlay-arrow-position)) (overlay-put compilation-arrow-overlay 'before-string compilation--dummy-string) - (set-window-margins (selected-window) (+ (or (car (window-margins)) 0) 2))) + (set-window-margins (selected-window) (+ (or (car (window-margins)) 0) 2)) + ;; Take precautions against `compilation-mode' getting reinitialized. + (add-hook 'change-major-mode-hook + 'compilation-tear-down-arrow-spec-in-margin nil t)) (defun compilation-tear-down-arrow-spec-in-margin () "Restore compilation-arrow-overlay to not using the margin, which is removed." commit 2fa33eb6ee20e48a4c6488bb0d55b3c1c9a1f721 Author: Mattias EngdegÄrd Date: Sun Sep 29 16:59:58 2019 +0200 Add `rx-submatch-n' for compatibility (bug#37517) It was an internal symbol in the old `rx' implementation, used in old versions of the `flycheck' package. * lisp/emacs-lisp/rx.el (rx-submatch-n): Alias of `rx-to-string'. * test/lisp/emacs-lisp/rx-tests.el (rx-compat): Test it. diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index a192ed1ad2..45fec796cc 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -1254,6 +1254,9 @@ following constructs: `(app (match-string ,i) ,name)) (reverse rx--pcase-vars)))))) +;; Obsolete internal symbol, used in old versions of the `flycheck' package. +(define-obsolete-function-alias 'rx-submatch-n 'rx-to-string "27.1") + (provide 'rx) ;;; rx.el ends here diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el index 11de4771de..76dcf41942 100644 --- a/test/lisp/emacs-lisp/rx-tests.el +++ b/test/lisp/emacs-lisp/rx-tests.el @@ -416,5 +416,8 @@ (should (equal (rx-to-string '(seq (delta a b c) (* (epsilon d e))) t) "\\(?:<(delta a b c)>\\)\\(?:<(epsilon d e)>\\)*")))) +(ert-deftest rx-compat () + "Test old symbol retained for compatibility (bug#37517)." + (should (equal (rx-submatch-n '(group-n 3 (+ nonl) eol)) "\\(?3:.+$\\)"))) (provide 'rx-tests) commit 9d7fae5ab198f7f33ebb3e791475b4e1a0082f61 Author: Lars Ingebrigtsen Date: Sun Sep 29 14:58:38 2019 +0200 Fix reverting doc-view buffers * lisp/doc-view.el (doc-view--revert-buffer): Actually use the new version of the PDF data (bug#26996). diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 9d10d03628..9fe177a184 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -448,7 +448,12 @@ Typically \"page-%s.png\".") (setq-local undo-outer-limit (* 2 (buffer-size)))) (cl-labels ((revert () (let ((revert-buffer-preserve-modes t)) - (apply orig-fun args)))) + (apply orig-fun args) + ;; Update the cached version of the pdf file, + ;; too. This is the one that's used when + ;; rendering. + (doc-view-make-safe-dir doc-view-cache-directory) + (write-region nil nil doc-view--buffer-file-name)))) (if (and (eq 'pdf doc-view-doc-type) (executable-find "pdfinfo")) ;; We don't want to revert if the PDF file is corrupted which commit c9af343448e890a80093db03dd9a70f55c0cbde3 Author: Lars Ingebrigtsen Date: Sun Sep 29 14:26:26 2019 +0200 Allow customising pdf-to-text parameters * lisp/doc-view.el (doc-view-pdf->txt): Allow customising the parameters (bug#8519). (doc-view-pdftotext-program-args): New variable. diff --git a/etc/NEWS b/etc/NEWS index f858c95831..cb8b6fcac1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -607,6 +607,9 @@ its functions. *** New commands 'doc-view-presentation' and 'doc-view-fit-window-to-page'. *** Added support for password-protected PDF files +*** A new variable 'doc-view-pdftotext-program-args' has been added to +allow controlling how the conversion to text is done. + ** Ido *** New user option 'ido-big-directories' to mark directories whose names match certain regular expressions as big. Ido won't attempt to diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 49d2b56b7d..9d10d03628 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -172,6 +172,11 @@ :type 'file :version "24.4") +(defcustom doc-view-pdftotext-program-args '("-raw") + "Parameters to give to the pdftotext command." + :version "27.1" + :type '(repeat string)) + (defcustom doc-view-pdf->png-converter-function (if (executable-find doc-view-pdfdraw-program) #'doc-view-pdf->png-converter-mupdf @@ -1132,7 +1137,8 @@ Start by converting PAGES, and then the rest." (or (executable-find doc-view-pdftotext-program) (error "You need the `pdftotext' program to convert a PDF to text")) (doc-view-start-process "pdf->txt" doc-view-pdftotext-program - (list "-raw" pdf txt) + (append doc-view-pdftotext-program-args + (list pdf txt)) callback)) (defun doc-view-current-cache-doc-pdf () commit 58847eaf0d66ec4747ca56974327ccff2ba6c264 Author: Lars Ingebrigtsen Date: Sun Sep 29 13:34:23 2019 +0200 Try ImageMagick last for external image converters * lisp/image/image-converter.el (image-converter--converters): Move ImageMagick last in the list. diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el index 5bb4e103a7..e91d87af40 100644 --- a/lisp/image/image-converter.el +++ b/lisp/image/image-converter.el @@ -44,8 +44,8 @@ installed on the system." (defvar image-converter--converters '((graphicsmagick :command "gm convert" :probe "-list format") - (imagemagick :command "convert" :probe "-list format") - (ffmpeg :command "ffmpeg" :probe "-decoders")) + (ffmpeg :command "ffmpeg" :probe "-decoders") + (imagemagick :command "convert" :probe "-list format")) "List of supported image converters to try.") (defun image-convert-p (file) commit 19405291aa5b1f7de7e44cc2efe384840b144236 Author: Mattias EngdegÄrd Date: Sun Sep 22 15:03:02 2019 +0200 Fix linear equation system solving in Calc (bug#35374) * lisp/calc/calcalg2.el (math-try-solve-for): To solve Ax^n=0 where A is a nonzero constant and x the variable to solve for, solve x^n=0 instead of solving A=0 (which obviously fails) or something equally stupid. * test/lisp/calc/calc-tests.el (calc-test-solve-linear-system): New. diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el index 18243bfc74..2a716633ae 100644 --- a/lisp/calc/calcalg2.el +++ b/lisp/calc/calcalg2.el @@ -2417,6 +2417,12 @@ ((= (length math-t1) 2) (apply 'math-solve-linear (car math-t2) math-try-solve-sign math-t1)) + ((= (length math-t1) 1) + ;; Constant polynomial. + (if (eql (nth 2 math-t2) 1) + nil ; No possible solution. + ;; Root of the factor, if any. + (math-try-solve-for (nth 2 math-t2) 0 nil t))) (math-solve-full (math-poly-all-roots (car math-t2) math-t1)) (calc-symbolic-mode nil) diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el index e1ee20b5d2..36a81dc2b7 100644 --- a/test/lisp/calc/calc-tests.el +++ b/test/lisp/calc/calc-tests.el @@ -215,6 +215,109 @@ An existing calc stack is reused, otherwise a new one is created." (should (equal (math-absolute-from-julian-dt -101 3 1) -36832)) (should (equal (math-absolute-from-julian-dt -4713 1 1) -1721425))) +(ert-deftest calc-test-solve-linear-system () + "Test linear system solving (bug#35374)." + ;; x + y = 3 + ;; 2x - 3y = -4 + ;; with the unique solution x=1, y=2 + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq (+ (var x var-x) (var y var-y)) 3) + (calcFunc-eq (- (* 2 (var x var-x)) (* 3 (var y var-y))) -4)) + '(vec (var x var-x) (var y var-y))) + '(vec (calcFunc-eq (var x var-x) 1) + (calcFunc-eq (var y var-y) 2)))) + + ;; x + y = 1 + ;; x + y = 2 + ;; has no solution + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq (+ (var x var-x) (var y var-y)) 1) + (calcFunc-eq (+ (var x var-x) (var y var-y)) 2)) + '(vec (var x var-x) (var y var-y))) + '(calcFunc-solve + (vec + (calcFunc-eq (+ (var x var-x) (var y var-y)) 1) + (calcFunc-eq (+ (var x var-x) (var y var-y)) 2)) + (vec (var x var-x) (var y var-y))))) + ;; x - y = 1 + ;; x + y = 1 + ;; with the unique solution x=1, y=0 + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq (- (var x var-x) (var y var-y)) 1) + (calcFunc-eq (+ (var x var-x) (var y var-y)) 1)) + '(vec (var x var-x) (var y var-y))) + '(vec (calcFunc-eq (var x var-x) 1) + (calcFunc-eq (var y var-y) 0)))) + ;; 2x - 3y + z = 5 + ;; x + y - 2z = 0 + ;; -x + 2y + 3z = -3 + ;; with the unique solution x=1, y=-1, z=0 + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq + (+ (- (* 2 (var x var-x)) (* 3 (var y var-y))) (var z var-z)) + 5) + (calcFunc-eq + (- (+ (var x var-x) (var y var-y)) (* 2 (var z var-z))) + 0) + (calcFunc-eq + (+ (- (* 2 (var y var-y)) (var x var-x)) (* 3 (var z var-z))) + -3)) + '(vec (var x var-x) (var y var-y) (var z var-z))) + ;; The `float' forms in the result are just artefacts of Calc's + ;; current solver; it should be fixed to produce exact (integral) + ;; results in this case. + '(vec (calcFunc-eq (var x var-x) (float 1 0)) + (calcFunc-eq (var y var-y) (float -1 0)) + (calcFunc-eq (var z var-z) 0)))) + ;; x = y + 1 + ;; x = y + ;; has no solution + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq (var x var-x) (+ (var y var-y) 1)) + (calcFunc-eq (var x var-x) (var y var-y))) + '(vec (var x var-x) (var y var-y))) + '(calcFunc-solve + (vec + (calcFunc-eq (var x var-x) (+ (var y var-y) 1)) + (calcFunc-eq (var x var-x) (var y var-y))) + (vec (var x var-x) (var y var-y))))) + ;; x + y + z = 6 + ;; x + y = 3 + ;; x - y = 1 + ;; with the unique solution x=2, y=1, z=3 + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq (+ (+ (var x var-x) (var y var-y)) (var z var-z)) 6) + (calcFunc-eq (+ (var x var-x) (var y var-y)) 3) + (calcFunc-eq (- (var x var-x) (var y var-y)) 1)) + '(vec (var x var-x) (var y var-y) (var z var-z))) + '(vec + (calcFunc-eq (var x var-x) 2) + (calcFunc-eq (var y var-y) 1) + (calcFunc-eq (var z var-z) 3)))) + ;; x = 3 + ;; x + 4y^2 = 3 (ok, so this one isn't linear) + ;; with the unique (double) solution x=3, y=0 + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq (var x var-x) 3) + (calcFunc-eq (+ (var x var-x) (* 4 (^ (var y var-y) 2))) 3)) + '(vec (var x var-x) (var y var-y))) + '(vec (calcFunc-eq (var x var-x) 3) + (calcFunc-eq (var y var-y) 0))))) + (provide 'calc-tests) ;;; calc-tests.el ends here commit ab2a8f70775ff1c51e3b3b5f7b337c3fe5132db2 Author: Lars Ingebrigtsen Date: Sun Sep 29 13:32:30 2019 +0200 Move convert-images-externally documentation to Emacs manual * doc/emacs/files.texi (File Conveniences): Move bit about convert-images-externally to user manual from lispref manual. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 36ef1dcea2..35ba30adb3 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -2161,6 +2161,15 @@ never be rendered using ImageMagick, regardless of the value of but Emacs should not). To disable ImageMagick entirely, change @code{imagemagick-types-inhibit} to @code{t}. +@vindex convert-images-externally + If Emacs doesn't have native support for the image format in +question, and @code{convert-images-externally} is non-@code{nil}, +Emacs will try to determine whether there are external utilities that +can be used to transform the image in question to @acronym{PNG} before +displaying. GraphicsMagick, ImageMagick and @command{ffmpeg} are +currently supported for image conversions. + + @findex thumbs-mode @cindex mode, Thumbs The Image-Dired package can also be used to view images as diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index a661eca13f..fd6820897f 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -6044,14 +6044,6 @@ properties---for example, (create-image "foo.xpm" 'xpm nil :heuristic-mask t) @end example -@vindex convert-images-externally -If Emacs doesn't have native support for the image format in question, -and @code{convert-images-externally} is non-@code{nil}, Emacs will try -to determine whether there are external utilities that can be used to -transform the image in question to @acronym{PNG} before displaying. -GraphicsMagick, ImageMagick and @command{ffmpeg} are currently -supported for image conversions. - The function returns @code{nil} if images of this type are not supported. Otherwise it returns an image descriptor. @end defun commit f19879c36a1613ffe15d13457791817c57faa82e Author: Lars Ingebrigtsen Date: Sun Sep 29 13:26:33 2019 +0200 Remove duplicated image conversion defcustom * lisp/image/image-converter.el (convert-external-images): Remove defcustom that was accidentally not removed when moving to image.el (and renamed). diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el index 25b49ff103..5bb4e103a7 100644 --- a/lisp/image/image-converter.el +++ b/lisp/image/image-converter.el @@ -29,17 +29,6 @@ (require 'cl-generic) (eval-when-compile (require 'cl-lib)) -(defcustom convert-external-images nil - "If non-nil, `create-image' will use external converters for exotic formats. -Emacs handles most of the common image formats (JPEG, PNG, GIF -and so on) internally, but images that doesn't have native -support in Emacs can still be displayed by Emacs if external -conversion programs (like ImageMagick \"convert\", GraphicsMagick -\"gm\" or \"ffmpeg\") are installed." - :group 'image - :type 'bool - :version "27.1") - (defcustom image-converter nil "Type of the external image converter to use. The value should a symbol, either `imagemagick', `graphicsmagick', commit 9767bd2b78a8fd7ab1279fbb98a40380bbfbc3e0 Author: Lars Ingebrigtsen Date: Sun Sep 29 13:04:01 2019 +0200 Add some commented-out tests for iso8601 diff --git a/test/lisp/calendar/iso8601-tests.el b/test/lisp/calendar/iso8601-tests.el index 35c319ed03..8d2aec3de5 100644 --- a/test/lisp/calendar/iso8601-tests.el +++ b/test/lisp/calendar/iso8601-tests.el @@ -153,13 +153,25 @@ (should (equal (iso8601-parse-time "15") '(0 0 15 nil nil nil nil nil nil)))) -(ert-deftest standard-test-time-of-day-fractions () - ;; decoded-time doesn't support sub-second times. - ;; (should (equal (iso8601-parse-time "152735,5") - ;; '(46 27 15 nil nil nil nil nil nil))) - ;; (should (equal (iso8601-parse-time "15:27:35,5") - ;; '(46 27 15 nil nil nil nil nil nil))) - ) +;; Not implemented yet. + +;; (ert-deftest standard-test-time-of-day-fractions () +;; (should (equal (iso8601-parse-time "152735,5") +;; '(46 27 15 nil nil nil nil nil nil))) +;; (should (equal (iso8601-parse-time "15:27:35,5") +;; '(46 27 15 nil nil nil nil nil nil))) + +;; (should (equal (iso8601-parse-time "2320,8") +;; '(46 27 15 nil nil nil nil nil nil))) +;; (should (equal (iso8601-parse-time "23:20,8") +;; '(46 27 15 nil nil nil nil nil nil))) + +;; (should (equal (iso8601-parse-time "23,3") +;; '(46 27 15 nil nil nil nil nil nil)))) + +;; (ert-deftest nonstandard-test-time-of-day-decimals () +;; (should (equal (iso8601-parse-time "15:27:35.123") +;; '(46 27 15 nil nil nil nil nil nil)))) (ert-deftest standard-test-time-of-day-beginning-of-day () (should (equal (iso8601-parse-time "000000") commit 96636a8e1f5e91edb8ac4e88e0723beb7c71e160 Author: Lars Ingebrigtsen Date: Sun Sep 29 13:03:08 2019 +0200 Fix up iso8601 time match regexp * lisp/calendar/iso8601.el (iso8601--time-match): The fraction mark can be either . or , and there can be arbitrarily many digits in the fraction. diff --git a/lisp/calendar/iso8601.el b/lisp/calendar/iso8601.el index 0f42c824e3..f8949914f7 100644 --- a/lisp/calendar/iso8601.el +++ b/lisp/calendar/iso8601.el @@ -83,7 +83,7 @@ iso8601--ordinal-date-match))) (defconst iso8601--time-match - "\\([0-9][0-9]\\):?\\([0-9][0-9]\\)?:?\\([0-9][0-9]\\)?\\.?\\([0-9][0-9][0-9]\\)?") + "\\([0-9][0-9]\\):?\\([0-9][0-9]\\)?:?\\([0-9][0-9]\\)?[.,]?\\([0-9]+\\)?") (defconst iso8601--zone-match "\\(Z\\|\\([-+]\\)\\([0-9][0-9]\\):?\\([0-9][0-9]\\)?\\)") @@ -232,7 +232,7 @@ well as variants like \"2008W32\" (week number) and (string-to-number (match-string 3 time)))) ;; Hm... (_millisecond (and (match-string 4 time) - (string-to-number (match-string 4 time))))) + (string-to-number (match-string 4 time))))) (iso8601--decoded-time :hour hour :minute (or minute 0) :second (or second 0) commit 46eb6df45358f413847ceb882898b2326f7584c8 Author: Lars Ingebrigtsen Date: Sun Sep 29 12:38:44 2019 +0200 Put new Gnus groups in the completion table * lisp/gnus/gnus-start.el (gnus-group-change-level): Ensure that all new groups are in gnus-active-hashtb so that they can be completed to. diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index cb369f07b9..e142c438ee 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -1269,6 +1269,10 @@ string name) to insert this group before." (consp entry)) (setq oldlevel (gnus-info-level (nth 1 entry))) (setq oldlevel (or oldlevel gnus-level-killed))) + + ;; This table is used for completion, so put a dummy entry there. + (unless (gethash group gnus-active-hashtb) + (setf (gethash group gnus-active-hashtb) nil)) ;; Group is already subscribed. (unless (and (>= oldlevel gnus-level-zombie) (gnus-group-entry group)) commit e8db2f51417e330a339136b416b7c5d4e296beca Author: Lars Ingebrigtsen Date: Sun Sep 29 12:38:02 2019 +0200 Define nndraft-close-server according to new calling conventions * lisp/gnus/nnoo.el (nnoo-define-basics-1): *-close-server now takes a DEFS parameter (bug#20319). diff --git a/lisp/gnus/nnoo.el b/lisp/gnus/nnoo.el index c65668a719..d52cda4eb5 100644 --- a/lisp/gnus/nnoo.el +++ b/lisp/gnus/nnoo.el @@ -277,11 +277,12 @@ (nnoo-define-basics-1 ',backend))) (defun nnoo-define-basics-1 (backend) - (let ((functions '(close-server server-opened status-message))) - (while functions - (eval `(deffoo ,(nnoo-symbol backend (car functions)) - (&optional server) - (,(nnoo-symbol 'nnoo (pop functions)) ',backend server))))) + (dolist (function '(server-opened status-message)) + (eval `(deffoo ,(nnoo-symbol backend function) (&optional server) + (,(nnoo-symbol 'nnoo function) ',backend server)))) + (dolist (function '(close-server)) + (eval `(deffoo ,(nnoo-symbol backend function) (&optional server defs) + (,(nnoo-symbol 'nnoo function) ',backend server)))) (eval `(deffoo ,(nnoo-symbol backend 'open-server) (server &optional defs) (nnoo-change-server ',backend server defs))))