commit cf9ce4fcfc38ef3eda01fcc504f4d792fcabe6d5 (HEAD, refs/remotes/origin/master) Author: Tino Calancha Date: Wed Jan 25 15:15:16 2017 +0900 ediff-difference-vector-alist: Drop duplicated definition * lisp/vc/ediff-init.el (ediff-difference-vector-alist): Drop duplicated definition. (ediff-difference-vector-A, ediff-difference-vector-B) (ediff-difference-vector-C, ediff-difference-vector-Ancestor): Move definition before 'ediff-difference-vector-alist'. diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 95568b29c7..0235926fbe 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -150,6 +150,26 @@ It needs to be killed when we quit the session.") (defsubst ediff-get-symbol-from-alist (buf-type alist) (cdr (assoc buf-type alist))) +;; Vector of differences between the variants. Each difference is +;; represented by a vector of two overlays plus a vector of fine diffs, +;; plus a no-fine-diffs flag. The first overlay spans the +;; difference region in the A buffer and the second overlays the diff in +;; the B buffer. If a difference section is empty, the corresponding +;; overlay's endpoints coincide. +;; +;; The precise form of a Difference Vector for one buffer is: +;; [diff diff diff ...] +;; where each diff has the form: +;; [diff-overlay fine-diff-vector no-fine-diffs-flag state-of-diff] +;; fine-diff-vector is a vector [fine-diff-overlay fine-diff-overlay ...] +;; no-fine-diffs-flag says if there are fine differences. +;; state-of-difference is A, B, C, or nil, indicating which buffer is +;; different from the other two (used only in 3-way jobs. +(ediff-defvar-local ediff-difference-vector-A nil "") +(ediff-defvar-local ediff-difference-vector-B nil "") +(ediff-defvar-local ediff-difference-vector-C nil "") +(ediff-defvar-local ediff-difference-vector-Ancestor nil "") +;; A-list of diff vector types associated with buffer types (defconst ediff-difference-vector-alist '((A . ediff-difference-vector-A) (B . ediff-difference-vector-B) @@ -642,32 +662,6 @@ shown in brighter colors." ;;buffer-read-only mode-line-format)) -;; Vector of differences between the variants. Each difference is -;; represented by a vector of two overlays plus a vector of fine diffs, -;; plus a no-fine-diffs flag. The first overlay spans the -;; difference region in the A buffer and the second overlays the diff in -;; the B buffer. If a difference section is empty, the corresponding -;; overlay's endpoints coincide. -;; -;; The precise form of a Difference Vector for one buffer is: -;; [diff diff diff ...] -;; where each diff has the form: -;; [diff-overlay fine-diff-vector no-fine-diffs-flag state-of-diff] -;; fine-diff-vector is a vector [fine-diff-overlay fine-diff-overlay ...] -;; no-fine-diffs-flag says if there are fine differences. -;; state-of-difference is A, B, C, or nil, indicating which buffer is -;; different from the other two (used only in 3-way jobs. -(ediff-defvar-local ediff-difference-vector-A nil "") -(ediff-defvar-local ediff-difference-vector-B nil "") -(ediff-defvar-local ediff-difference-vector-C nil "") -(ediff-defvar-local ediff-difference-vector-Ancestor nil "") -;; A-list of diff vector types associated with buffer types -(defconst ediff-difference-vector-alist - '((A . ediff-difference-vector-A) - (B . ediff-difference-vector-B) - (C . ediff-difference-vector-C) - (Ancestor . ediff-difference-vector-Ancestor))) - ;; [ status status status ...] ;; Each status: [state-of-merge state-of-ancestor] ;; state-of-merge is default-A, default-B, prefer-A, or prefer-B. It commit f580ea195bfdef71de1642311f27c2aff1e4b41c Author: Lars Ingebrigtsen Date: Wed Jan 25 01:18:43 2017 +0100 Revert "nnimap.el: support additional expunge options" This reverts commit 4e9baea6aba1633074889339dcc7cdc9d73880d3. The patch broke fetching new mail: Debugger entered--Lisp error: (error "Format specifier doesn’t match argument type") format("%d .*\n" (t ("OK" ("HIGHESTMODSEQ" "914696") "Expunge" "completed.") ("VANISHED" "1825937") ("0" "RECENT"))) (looking-at (format "%d .*\n" sequence)) (not (looking-at (format "%d .*\n" sequence))) (progn (while (and (not (bobp)) (progn (forward-line -1) (looking-at "\\*\\|[0-9]+ OK NOOP")))) (not (looking-at (format "%d .*\n" sequence)))) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index e8524fb03f..05159d4b2f 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -14273,19 +14273,9 @@ specific login method to be used, you can set this variable to either @code{plain} or @code{cram-md5}. @item nnimap-expunge -When to expunge deleted messages. If @code{never}, deleted articles -are marked with the IMAP @code{\\Delete} flag but not automatically -expunged. If @code{immediately}, deleted articles are immediately expunged -(this requires the server to support the UID EXPUNGE command). If -@code{on-exit}, deleted articles are flagged, and all flagged articles are -expunged when the group is closed. - -For backwards compatibility, this variable may also be set to t -or nil. If the server supports UID EXPUNGE, both t and nil are -equivalent to @code{immediately}. If the server does not support UID -EXPUNGE nil is equivalent to @code{never}, while t will immediately -expunge ALL articles that are currently flagged as deleted -(i.e., potentially not only the article that was just deleted). +If non-@code{nil}, expunge articles after deleting them. This is always done +if the server supports UID EXPUNGE, but it's not done by default on +servers that doesn't support that command. @item nnimap-streaming Virtually all @acronym{IMAP} server support fast streaming of data. diff --git a/etc/NEWS b/etc/NEWS index e5ee40cbe4..ca66df6261 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -81,16 +81,6 @@ for '--daemon'. * Changes in Emacs 26.1 +++ -** The Gnus user variable 'nnimap-expunge' supports three new values: -'never' for never expunging messages, 'immediately' for immediately -expunging deleted messages, and 'on-exit' to expunge deleted articles -when exiting the group's summary buffer. Setting 'nnimap-expunge' to -'nil' or 't' is still supported but not recommended, since it may -result in Gnus expunging all messages that have been flagged as -deleted by any IMAP client (rather than just those that have been -deleted by Gnus). - -+++ ** The new function 'mapbacktrace' applies a function to all frames of the current stack trace. diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 931ec31208..700e86a0c5 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -92,21 +92,10 @@ Uses the same syntax as `nnmail-split-methods'.") Possible choices are nil (use default methods), `anonymous', `login', `plain' and `cram-md5'.") -(defvoo nnimap-expunge 'on-exit - "When to expunge deleted messages. -If 'never, deleted articles are marked with the IMAP \\Delete -flag but not automatically expunged. If 'immediately, deleted -articles are immediately expunged (this requires the server to -support the UID EXPUNGE command). If 'on-exit, deleted articles -are flagged, and all flagged articles are expunged when the -group is closed. - -For backwards compatibility, this variable may also be set to t -or nil. If the server supports UID EXPUNGE, both t and nil are -equivalent to 'immediately. If the server does not support UID -EXPUNGE nil is equivalent to 'never, while t will immediately -expunge ALL articles that are currently flagged as deleted -(i.e., potentially not only the article that was just deleted).") +(defvoo nnimap-expunge t + "If non-nil, expunge articles after deleting them. +This is always done if the server supports UID EXPUNGE, but it's +not done by default on servers that doesn't support that command.") (defvoo nnimap-streaming t "If non-nil, try to use streaming commands with IMAP servers. @@ -921,12 +910,8 @@ textual parts.") articles))) (nreverse articles))) -(deffoo nnimap-close-group (_group &optional server) - (when (eq nnimap-expunge 'on-exit) - (nnoo-change-server 'nnimap server nil) - (with-current-buffer (nnimap-buffer) - (nnimap-wait-for-response - (nnimap-send-command "EXPUNGE"))))) +(deffoo nnimap-close-group (_group &optional _server) + t) (deffoo nnimap-request-move-article (article group server accept-form &optional _last @@ -975,7 +960,8 @@ textual parts.") articles) ((and force (eq nnmail-expiry-target 'delete)) - (nnimap-delete-article (gnus-compress-sequence articles)) + (unless (nnimap-delete-article (gnus-compress-sequence articles)) + (nnheader-message 7 "Article marked for deletion, but not expunged.")) nil) (t (let ((deletable-articles @@ -1098,38 +1084,21 @@ If LIMIT, first try to limit the search to the N last articles." (when (and limit number-of-article) (nnimap-find-article-by-message-id group server message-id)))))))) -(defun nnimap-delete-article (articles &optional sync) - "Delete ARTICLES. - -If sync is non-nil, wait for server response." +(defun nnimap-delete-article (articles) (with-current-buffer (nnimap-buffer) (nnimap-command "UID STORE %s +FLAGS.SILENT (\\Deleted)" (nnimap-article-ranges articles)) - (let ((sequence (cond - ((eq nnimap-expunge 'immediately) - (if (nnimap-capability "UIDPLUS") + ((nnimap-capability "UIDPLUS") (nnimap-command "UID EXPUNGE %s" (nnimap-article-ranges articles)) - (nnheader-message - 3 (concat "nnimap-expunge set to 'immediately, but " - "server doesn't support UIDPLUS")))) - - ((memq nnimap-expunge '(on-exit never)) nil) - - ((nnimap-capability "UIDPLUS") - (nnimap-command "UID EXPUNGE %s" - (nnimap-article-ranges articles))) - + t) (nnimap-expunge - (nnimap-command "EXPUNGE")) - - (t - (nnheader-message - 7 "Article marked for deletion, but not expunged."))))) - - (if (and sync sequence) - (nnimap-wait-for-response sequence))))) + (nnimap-command "EXPUNGE") + t) + (t (gnus-message 7 (concat "nnimap: nnimap-expunge is not set and the " + "server doesn't support UIDPLUS, so we won't " + "delete this article now")))))) (deffoo nnimap-request-scan (&optional group server) (when group @@ -2149,9 +2118,27 @@ Return the server's response to the SELECT or EXAMINE command." (nnimap-wait-for-response (caar sequences)) ;; And then mark the successful copy actions as deleted, ;; and possibly expunge them. - (nnimap-delete-article - (nnimap-parse-copied-articles sequences) t)) - (nnimap-delete-article junk-articles t))))))) + (nnimap-mark-and-expunge-incoming + (nnimap-parse-copied-articles sequences))) + (nnimap-mark-and-expunge-incoming junk-articles))))))) + +(defun nnimap-mark-and-expunge-incoming (range) + (when range + (setq range (nnimap-article-ranges range)) + (erase-buffer) + (let ((sequence + (nnimap-send-command + "UID STORE %s +FLAGS.SILENT (\\Deleted)" range))) + (cond + ;; If the server supports it, we now delete the message we have + ;; just copied over. + ((nnimap-capability "UIDPLUS") + (setq sequence (nnimap-send-command "UID EXPUNGE %s" range))) + ;; If it doesn't support UID EXPUNGE, then we only expunge if the + ;; user has configured it. + (nnimap-expunge + (setq sequence (nnimap-send-command "EXPUNGE")))) + (nnimap-wait-for-response sequence)))) (defun nnimap-parse-copied-articles (sequences) (let (sequence copied range) commit 4e9baea6aba1633074889339dcc7cdc9d73880d3 Author: Nikolaus Rath Date: Wed Jan 25 00:46:13 2017 +0100 nnimap.el: support additional expunge options * lisp/gnus/nnimap.el (nnimap-close-group) (nnimap-request-expire-articles, nnimap-delete-article) (nnimap-request-scan): add new 'never, 'immediate, and 'on-exit settings for nnimap-expunge (bug#20670). diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 05159d4b2f..e8524fb03f 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -14273,9 +14273,19 @@ specific login method to be used, you can set this variable to either @code{plain} or @code{cram-md5}. @item nnimap-expunge -If non-@code{nil}, expunge articles after deleting them. This is always done -if the server supports UID EXPUNGE, but it's not done by default on -servers that doesn't support that command. +When to expunge deleted messages. If @code{never}, deleted articles +are marked with the IMAP @code{\\Delete} flag but not automatically +expunged. If @code{immediately}, deleted articles are immediately expunged +(this requires the server to support the UID EXPUNGE command). If +@code{on-exit}, deleted articles are flagged, and all flagged articles are +expunged when the group is closed. + +For backwards compatibility, this variable may also be set to t +or nil. If the server supports UID EXPUNGE, both t and nil are +equivalent to @code{immediately}. If the server does not support UID +EXPUNGE nil is equivalent to @code{never}, while t will immediately +expunge ALL articles that are currently flagged as deleted +(i.e., potentially not only the article that was just deleted). @item nnimap-streaming Virtually all @acronym{IMAP} server support fast streaming of data. diff --git a/etc/NEWS b/etc/NEWS index ca66df6261..e5ee40cbe4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -81,6 +81,16 @@ for '--daemon'. * Changes in Emacs 26.1 +++ +** The Gnus user variable 'nnimap-expunge' supports three new values: +'never' for never expunging messages, 'immediately' for immediately +expunging deleted messages, and 'on-exit' to expunge deleted articles +when exiting the group's summary buffer. Setting 'nnimap-expunge' to +'nil' or 't' is still supported but not recommended, since it may +result in Gnus expunging all messages that have been flagged as +deleted by any IMAP client (rather than just those that have been +deleted by Gnus). + ++++ ** The new function 'mapbacktrace' applies a function to all frames of the current stack trace. diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 700e86a0c5..931ec31208 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -92,10 +92,21 @@ Uses the same syntax as `nnmail-split-methods'.") Possible choices are nil (use default methods), `anonymous', `login', `plain' and `cram-md5'.") -(defvoo nnimap-expunge t - "If non-nil, expunge articles after deleting them. -This is always done if the server supports UID EXPUNGE, but it's -not done by default on servers that doesn't support that command.") +(defvoo nnimap-expunge 'on-exit + "When to expunge deleted messages. +If 'never, deleted articles are marked with the IMAP \\Delete +flag but not automatically expunged. If 'immediately, deleted +articles are immediately expunged (this requires the server to +support the UID EXPUNGE command). If 'on-exit, deleted articles +are flagged, and all flagged articles are expunged when the +group is closed. + +For backwards compatibility, this variable may also be set to t +or nil. If the server supports UID EXPUNGE, both t and nil are +equivalent to 'immediately. If the server does not support UID +EXPUNGE nil is equivalent to 'never, while t will immediately +expunge ALL articles that are currently flagged as deleted +(i.e., potentially not only the article that was just deleted).") (defvoo nnimap-streaming t "If non-nil, try to use streaming commands with IMAP servers. @@ -910,8 +921,12 @@ textual parts.") articles))) (nreverse articles))) -(deffoo nnimap-close-group (_group &optional _server) - t) +(deffoo nnimap-close-group (_group &optional server) + (when (eq nnimap-expunge 'on-exit) + (nnoo-change-server 'nnimap server nil) + (with-current-buffer (nnimap-buffer) + (nnimap-wait-for-response + (nnimap-send-command "EXPUNGE"))))) (deffoo nnimap-request-move-article (article group server accept-form &optional _last @@ -960,8 +975,7 @@ textual parts.") articles) ((and force (eq nnmail-expiry-target 'delete)) - (unless (nnimap-delete-article (gnus-compress-sequence articles)) - (nnheader-message 7 "Article marked for deletion, but not expunged.")) + (nnimap-delete-article (gnus-compress-sequence articles)) nil) (t (let ((deletable-articles @@ -1084,21 +1098,38 @@ If LIMIT, first try to limit the search to the N last articles." (when (and limit number-of-article) (nnimap-find-article-by-message-id group server message-id)))))))) -(defun nnimap-delete-article (articles) +(defun nnimap-delete-article (articles &optional sync) + "Delete ARTICLES. + +If sync is non-nil, wait for server response." (with-current-buffer (nnimap-buffer) (nnimap-command "UID STORE %s +FLAGS.SILENT (\\Deleted)" (nnimap-article-ranges articles)) + (let ((sequence (cond - ((nnimap-capability "UIDPLUS") + ((eq nnimap-expunge 'immediately) + (if (nnimap-capability "UIDPLUS") (nnimap-command "UID EXPUNGE %s" (nnimap-article-ranges articles)) - t) + (nnheader-message + 3 (concat "nnimap-expunge set to 'immediately, but " + "server doesn't support UIDPLUS")))) + + ((memq nnimap-expunge '(on-exit never)) nil) + + ((nnimap-capability "UIDPLUS") + (nnimap-command "UID EXPUNGE %s" + (nnimap-article-ranges articles))) + (nnimap-expunge - (nnimap-command "EXPUNGE") - t) - (t (gnus-message 7 (concat "nnimap: nnimap-expunge is not set and the " - "server doesn't support UIDPLUS, so we won't " - "delete this article now")))))) + (nnimap-command "EXPUNGE")) + + (t + (nnheader-message + 7 "Article marked for deletion, but not expunged."))))) + + (if (and sync sequence) + (nnimap-wait-for-response sequence))))) (deffoo nnimap-request-scan (&optional group server) (when group @@ -2118,27 +2149,9 @@ Return the server's response to the SELECT or EXAMINE command." (nnimap-wait-for-response (caar sequences)) ;; And then mark the successful copy actions as deleted, ;; and possibly expunge them. - (nnimap-mark-and-expunge-incoming - (nnimap-parse-copied-articles sequences))) - (nnimap-mark-and-expunge-incoming junk-articles))))))) - -(defun nnimap-mark-and-expunge-incoming (range) - (when range - (setq range (nnimap-article-ranges range)) - (erase-buffer) - (let ((sequence - (nnimap-send-command - "UID STORE %s +FLAGS.SILENT (\\Deleted)" range))) - (cond - ;; If the server supports it, we now delete the message we have - ;; just copied over. - ((nnimap-capability "UIDPLUS") - (setq sequence (nnimap-send-command "UID EXPUNGE %s" range))) - ;; If it doesn't support UID EXPUNGE, then we only expunge if the - ;; user has configured it. - (nnimap-expunge - (setq sequence (nnimap-send-command "EXPUNGE")))) - (nnimap-wait-for-response sequence)))) + (nnimap-delete-article + (nnimap-parse-copied-articles sequences) t)) + (nnimap-delete-article junk-articles t))))))) (defun nnimap-parse-copied-articles (sequences) (let (sequence copied range) commit b6fa58072304c2a24f1fe8a0e06a4739a7f8211b Author: Lars Ingebrigtsen Date: Wed Jan 25 00:29:24 2017 +0100 Don't tag Gnus bugs with "gnus" * lisp/gnus/gnus-msg.el (gnus-bug): Remove the bug package tags. * lisp/gnus/gnus.el (gnus-bug-package): Removed; Gnus doesn't have its own package any more in the bug tracker. diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 1911117119..e56f50cdad 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -1534,11 +1534,7 @@ If YANK is non-nil, include the original article." (message-pop-to-buffer "*Gnus Bug*")) (let ((message-this-is-mail t)) (message-setup `((To . ,gnus-maintainer) - (Subject . "") - (X-Debbugs-Package - . ,(format "%s" gnus-bug-package)) - (X-Debbugs-Version - . ,(format "%s" (gnus-continuum-version)))))) + (Subject . "")))) (when gnus-bug-create-help-buffer (push `(gnus-bug-kill-buffer) message-send-actions)) (goto-char (point-min)) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index ef6bd89c36..bbf85fe584 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -2654,10 +2654,6 @@ such as a mark that says whether an article is stored in the cache "submit@debbugs.gnu.org (The Gnus Bugfixing Girls + Boys)" "The mail address of the Gnus maintainers.") -(defconst gnus-bug-package - "gnus" - "The package to use in the bug submission.") - (defvar gnus-info-nodes '((gnus-group-mode "(gnus)Group Buffer") (gnus-summary-mode "(gnus)Summary Buffer") commit 42e23674133e881092c05814c6e11224e642f5f8 Author: Lars Ingebrigtsen Date: Wed Jan 25 00:23:28 2017 +0100 Tweak TLS error messaging on closed connections * src/gnutls.c (emacs_gnutls_handle_error): Demote the normal peer-closed-connection "The TLS connection was non-properly terminated" message to a lower level so that it isn't shown to the user by default. diff --git a/src/gnutls.c b/src/gnutls.c index 735d2e3581..6fa0e10972 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -582,8 +582,15 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err) if (gnutls_error_is_fatal (err)) { + int level = 1; + /* Mostly ignore "The TLS connection was non-properly + terminated" message which just means that the peer closed the + connection. */ + if (err == GNUTLS_E_PREMATURE_TERMINATION) + level = 3; + + GNUTLS_LOG2 (level, max_log_level, "fatal error:", str); ret = 0; - GNUTLS_LOG2 (1, max_log_level, "fatal error:", str); } else { commit 456696a838dfef73364ca025a210d2198fd8390d Author: Lars Ingebrigtsen Date: Tue Jan 24 23:39:05 2017 +0100 Avoid having eww unexpectedly open external browsers * lisp/net/eww.el (eww-render): Instead of opening unsupported content types like audio/mpeg directly in an external browser (which can be very confusing especially when something redirects to a file like that), just display a simple interstitial that people can choose to click on or not (bug#22671). diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 3e5d4467ea..172044a12e 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -364,7 +364,14 @@ Currently this means either text/html or application/xhtml+xml." ((and eww-use-external-browser-for-content-type (string-match-p eww-use-external-browser-for-content-type (car content-type))) - (eww-browse-with-external-browser url)) + (erase-buffer) + (insert "Unsupported content type") + (insert (format "

Content-type %s is unsupported

" + (car content-type))) + (insert (format "Direct link to the document" + url)) + (goto-char (point-min)) + (eww-display-html charset url nil point buffer encode)) ((eww-html-p (car content-type)) (eww-display-html charset url nil point buffer encode)) ((equal (car content-type) "application/pdf") commit fd42a19260841a2e3c39fd983c7601a3f517bf4b Author: Lars Ingebrigtsen Date: Tue Jan 24 22:40:57 2017 +0100 When opening new eww buffers, use buffer names based on the host name * lisp/net/eww.el (eww-browse-url): When opening in a new window, use a buffer name based on the host name (bug#23738). (eww--dwim-expand-url): Refactored out into its own function for easier reuse. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index d42180719d..3e5d4467ea 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -251,6 +251,29 @@ word(s) will be searched for via `eww-search-prefix'." (if uris (format " (default %s)" (car uris)) "") ": "))) (list (read-string prompt nil nil uris)))) + (setq url (eww--dwim-expand-url url)) + (pop-to-buffer-same-window + (if (eq major-mode 'eww-mode) + (current-buffer) + (get-buffer-create "*eww*"))) + (eww-setup-buffer) + ;; Check whether the domain only uses "Highly Restricted" Unicode + ;; IDNA characters. If not, transform to punycode to indicate that + ;; there may be funny business going on. + (let ((parsed (url-generic-parse-url url))) + (unless (puny-highly-restrictive-domain-p (url-host parsed)) + (setf (url-host parsed) (puny-encode-domain (url-host parsed))) + (setq url (url-recreate-url parsed)))) + (plist-put eww-data :url url) + (plist-put eww-data :title "") + (eww-update-header-line-format) + (let ((inhibit-read-only t)) + (insert (format "Loading %s..." url)) + (goto-char (point-min))) + (url-retrieve url 'eww-render + (list url nil (current-buffer)))) + +(defun eww--dwim-expand-url (url) (setq url (string-trim url)) (cond ((string-match-p "\\`file:/" url)) ;; Don't mangle file: URLs at all. @@ -275,26 +298,7 @@ word(s) will be searched for via `eww-search-prefix'." (setq url (concat url "/")))) (setq url (concat eww-search-prefix (replace-regexp-in-string " " "+" url)))))) - (pop-to-buffer-same-window - (if (eq major-mode 'eww-mode) - (current-buffer) - (get-buffer-create "*eww*"))) - (eww-setup-buffer) - ;; Check whether the domain only uses "Highly Restricted" Unicode - ;; IDNA characters. If not, transform to punycode to indicate that - ;; there may be funny business going on. - (let ((parsed (url-generic-parse-url url))) - (unless (puny-highly-restrictive-domain-p (url-host parsed)) - (setf (url-host parsed) (puny-encode-domain (url-host parsed))) - (setq url (url-recreate-url parsed)))) - (plist-put eww-data :url url) - (plist-put eww-data :title "") - (eww-update-header-line-format) - (let ((inhibit-read-only t)) - (insert (format "Loading %s..." url)) - (goto-char (point-min))) - (url-retrieve url 'eww-render - (list url nil (current-buffer)))) + url) ;;;###autoload (defalias 'browse-web 'eww) @@ -804,7 +808,10 @@ the like." ;;;###autoload (defun eww-browse-url (url &optional new-window) (when new-window - (pop-to-buffer-same-window (generate-new-buffer "*eww*")) + (pop-to-buffer-same-window + (generate-new-buffer + (format "*eww-%s*" (url-host (url-generic-parse-url + (eww--dwim-expand-url url)))))) (eww-mode)) (eww url)) commit aea6701839357eb139e29056274996c70f42b860 Author: David Engster Date: Tue Jan 24 22:47:53 2017 +0100 xml: Fix parsing of default namespace with quoted names * lisp/xml.el (xml-parse-attlist): Properly extract namespace when parsing is done with quoted symbol names (bug#23440). * test/lisp/xml-tests.el (xml-parse-test--default-namespace-qnames) (xml-parse-test-default-namespace-qnames): Test for the above. diff --git a/lisp/xml.el b/lisp/xml.el index cd801be308..be2ac96f26 100644 --- a/lisp/xml.el +++ b/lisp/xml.el @@ -646,8 +646,10 @@ surpassed `xml-entity-expansion-limit'")))) (defun xml-parse-attlist (&optional xml-ns) "Return the attribute-list after point. Leave point at the first non-blank character after the tag." - (let ((attlist ()) - end-pos name) + (let* ((attlist ()) + (symbol-qnames (eq (car-safe xml-ns) 'symbol-qnames)) + (xml-ns (if symbol-qnames (cdr xml-ns) xml-ns)) + end-pos name) (skip-syntax-forward " ") (while (looking-at (eval-when-compile (concat "\\(" xml-name-re "\\)\\s-*=\\s-*"))) diff --git a/test/lisp/xml-tests.el b/test/lisp/xml-tests.el index 0f2182a6a7..d0da2094db 100644 --- a/test/lisp/xml-tests.el +++ b/test/lisp/xml-tests.el @@ -134,6 +134,21 @@ Parser is called with and without 'symbol-qnames argument.") (append xml-default-ns '(("F" . "FOOBAR:")))))))))) +;; Test bug #23440 (proper expansion of default namespace) +; Test data for default namespace +(defvar xml-parse-test--default-namespace-qnames + (cons "" + '((myns:something + ((("http://www.w3.org/2000/xmlns/" . "") + . "myns:")) + (myns:whatever nil))))) + +(ert-deftest xml-parse-test-default-namespace-qnames () + (with-temp-buffer + (insert (car xml-parse-test--default-namespace-qnames)) + (should (equal (cdr xml-parse-test--default-namespace-qnames) + (xml-parse-region nil nil nil nil 'symbol-qnames))))) + ;; Local Variables: ;; no-byte-compile: t ;; End: commit 267c98ae4849e87bcee49ebbb7adcf211c60cd47 Author: Lars Ingebrigtsen Date: Tue Jan 24 22:21:45 2017 +0100 Fix rendering of some complex SVG images * lisp/net/shr.el (shr-parse-image-data): Don't transform SVG->DOM->XML unless we're blocking images, as this is apt to destroy the SVG (bug#24111). diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 2ee060611a..b7c4828849 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -979,7 +979,7 @@ element is the data blob and the second element is the content-type." (create-image data nil t :ascent 100 :format content-type)) ((eq content-type 'image/svg+xml) - (create-image data 'svg t :ascent 100)) + (create-image data 'imagemagick t :ascent 100)) ((eq size 'full) (ignore-errors (shr-rescale-image data content-type @@ -1067,8 +1067,7 @@ Return a string with image data." (when (ignore-errors (url-cache-extract (url-cache-create-filename (shr-encode-url url))) t) - (when (or (search-forward "\n\n" nil t) - (search-forward "\r\n\r\n" nil t)) + (when (re-search-forward "\r?\n\r?\n" nil t) (shr-parse-image-data))))) (declare-function libxml-parse-xml-region "xml.c" @@ -1087,9 +1086,12 @@ Return a string with image data." obarray))))))) ;; SVG images may contain references to further images that we may ;; want to block. So special-case these by parsing the XML data - ;; and remove the blocked bits. - (when (eq content-type 'image/svg+xml) + ;; and remove anything that looks like a blocked bit. + (when (and shr-blocked-images + (eq content-type 'image/svg+xml)) (setq data + ;; Note that libxml2 doesn't parse everything perfectly, + ;; so glitches may occur during this transformation. (shr-dom-to-xml (libxml-parse-xml-region (point) (point-max))))) (list data content-type))) commit 3180deacf5562262f8f7b177d1f5f06b8e3ae8a8 Author: Lars Ingebrigtsen Date: Tue Jan 24 21:33:51 2017 +0100 Clarify the last clarification * lisp/net/shr.el (shr-width): Clarify the interaction with `shr-use-fonts' (bug#24928). diff --git a/lisp/net/shr.el b/lisp/net/shr.el index cafb89e5b4..2ee060611a 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -97,8 +97,8 @@ If nil, don't draw horizontal table lines." "Frame width to use for rendering. May either be an integer specifying a fixed width in characters, or nil, meaning that the full width of the window should be used. -If `shr-use-fonts' is set, the mean width of a character is used -to compute the pixel width to be used." +If `shr-use-fonts' is set, the mean character width is used to +compute the pixel width, which is used instead." :version "25.1" :type '(choice (integer :tag "Fixed width in characters") (const :tag "Use the width of the window" nil)) commit 253fdf799bfff4e5a91dcdfd8c9f422ff015decf Author: Lars Ingebrigtsen Date: Tue Jan 24 21:31:17 2017 +0100 shr-width doc clarification * lisp/net/shr.el (shr-width): Clarify the interaction with `shr-use-fonts' (bug#24928). diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 1c2ea3c7bc..cafb89e5b4 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -96,8 +96,9 @@ If nil, don't draw horizontal table lines." (defcustom shr-width nil "Frame width to use for rendering. May either be an integer specifying a fixed width in characters, -or nil, meaning that the full width of the window should be -used." +or nil, meaning that the full width of the window should be used. +If `shr-use-fonts' is set, the mean width of a character is used +to compute the pixel width to be used." :version "25.1" :type '(choice (integer :tag "Fixed width in characters") (const :tag "Use the width of the window" nil)) commit 37567393a033f3feeec3d6ace30fa2dcd0419e26 Author: Lars Ingebrigtsen Date: Tue Jan 24 21:17:09 2017 +0100 Allow passing in max-width/height * lisp/net/shr.el (shr-rescale-image): Allow passing in max-width/height (bug#25287). diff --git a/lisp/net/shr.el b/lisp/net/shr.el index e0bb3dbb2b..1c2ea3c7bc 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1011,18 +1011,25 @@ element is the data blob and the second element is the content-type." image) (insert (or alt "")))) -(defun shr-rescale-image (data content-type width height) +(defun shr-rescale-image (data content-type width height + &optional max-width max-height) "Rescale DATA, if too big, to fit the current buffer. -WIDTH and HEIGHT are the sizes given in the HTML data, if any." +WIDTH and HEIGHT are the sizes given in the HTML data, if any. + +The size of the displayed image will not exceed +MAX-WIDTH/MAX-HEIGHT. If not given, use the current window +width/height instead." (if (or (not (fboundp 'imagemagick-types)) (not (get-buffer-window (current-buffer)))) (create-image data nil t :ascent 100) (let* ((edges (window-inside-pixel-edges (get-buffer-window (current-buffer)))) (max-width (truncate (* shr-max-image-proportion - (- (nth 2 edges) (nth 0 edges))))) + (or max-width + (- (nth 2 edges) (nth 0 edges)))))) (max-height (truncate (* shr-max-image-proportion - (- (nth 3 edges) (nth 1 edges))))) + (or max-height + (- (nth 3 edges) (nth 1 edges)))))) (scaling (image-compute-scaling-factor image-scaling-factor))) (when (or (and width (> width max-width)) commit 52a87c894d1e2351baecaff9ff061e3b83827220 Author: Stefan Monnier Date: Tue Jan 24 11:31:11 2017 -0500 * lisp/progmodes/vhdl-mode.el: Avoid add-to-list on local vars Require `cl' for `pushnew'. (vhdl-scan-project-contents, vhdl-compose-wire-components) (vhdl-uniquify): Use `pushnew' instead of `add-to-list'. diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 0e8ff525e6..6c76d7e4ad 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -126,6 +126,14 @@ ;;; Code: +(eval-when-compile (require 'cl)) +(eval-and-compile + ;; Before Emacs-24.4, `pushnew' expands to runtime calls to `cl-adjoin' + ;; even for relatively simple cases such as used here. We only test <25 + ;; because it's easier and sufficient. + (when (or (featurep 'xemacs) (< emacs-major-version 25)) + (require 'cl))) + ;; Emacs 21+ handling (defconst vhdl-emacs-21 (and (<= 21 emacs-major-version) (not (featurep 'xemacs))) "Non-nil if GNU Emacs 21, 22, ... is used.") @@ -14314,7 +14322,7 @@ of PROJECT." (vhdl-scan-directory-contents dir-name project nil (format "(%s/%s) " act-dir num-dir) (cdr dir-list)) - (add-to-list 'dir-list-tmp (file-name-directory dir-name)) + (pushnew (file-name-directory dir-name) dir-list-tmp :test #'equal) (setq dir-list (cdr dir-list) act-dir (1+ act-dir))) (vhdl-aput 'vhdl-directory-alist project (list (nreverse dir-list-tmp))) @@ -16406,8 +16414,8 @@ component instantiation." (if (or (member constant-name single-list) (member constant-name multi-list)) (progn (setq single-list (delete constant-name single-list)) - (add-to-list 'multi-list constant-name)) - (add-to-list 'single-list constant-name)) + (pushnew constant-name multi-list :test #'equal)) + (pushnew constant-name single-list :test #'equal)) (unless (match-string 1) (setq generic-alist (cdr generic-alist))) (vhdl-forward-syntactic-ws)) @@ -16433,12 +16441,12 @@ component instantiation." (member signal-name multi-out-list)) (setq single-out-list (delete signal-name single-out-list)) (setq multi-out-list (delete signal-name multi-out-list)) - (add-to-list 'local-list signal-name)) + (pushnew signal-name local-list :test #'equal)) ((member signal-name single-in-list) (setq single-in-list (delete signal-name single-in-list)) - (add-to-list 'multi-in-list signal-name)) + (pushnew signal-name multi-in-list :test #'equal)) ((not (member signal-name multi-in-list)) - (add-to-list 'single-in-list signal-name))) + (pushnew signal-name single-in-list :test #'equal))) ;; output signal (cond ((member signal-name local-list) @@ -16447,17 +16455,18 @@ component instantiation." (member signal-name multi-in-list)) (setq single-in-list (delete signal-name single-in-list)) (setq multi-in-list (delete signal-name multi-in-list)) - (add-to-list 'local-list signal-name)) + (pushnew signal-name local-list :test #'equal)) ((member signal-name single-out-list) (setq single-out-list (delete signal-name single-out-list)) - (add-to-list 'multi-out-list signal-name)) + (pushnew signal-name multi-out-list :test #'equal)) ((not (member signal-name multi-out-list)) - (add-to-list 'single-out-list signal-name)))) + (pushnew signal-name single-out-list :test #'equal)))) (unless (match-string 1) (setq port-alist (cdr port-alist))) (vhdl-forward-syntactic-ws)) (push (list inst-name (nreverse constant-alist) - (nreverse signal-alist)) inst-alist)) + (nreverse signal-alist)) + inst-alist)) ;; prepare signal insertion (vhdl-goto-marker arch-decl-pos) (forward-line 1) @@ -16534,14 +16543,14 @@ component instantiation." generic-end-pos (vhdl-compose-insert-generic constant-entry))) (setq generic-pos (point-marker)) - (add-to-list 'written-list constant-name)) + (pushnew constant-name written-list :test #'equal)) (t (vhdl-goto-marker (vhdl-max-marker generic-inst-pos generic-pos)) (setq generic-end-pos (vhdl-compose-insert-generic constant-entry)) (setq generic-inst-pos (point-marker)) - (add-to-list 'written-list constant-name)))) + (pushnew constant-name written-list :test #'equal)))) (setq constant-alist (cdr constant-alist))) (when (/= constant-temp-pos generic-inst-pos) (vhdl-goto-marker (vhdl-max-marker constant-temp-pos generic-pos)) @@ -16560,14 +16569,14 @@ component instantiation." (vhdl-max-marker port-end-pos (vhdl-compose-insert-port signal-entry))) (setq port-in-pos (point-marker)) - (add-to-list 'written-list signal-name)) + (pushnew signal-name written-list :test #'equal)) ((member signal-name multi-out-list) (vhdl-goto-marker (vhdl-max-marker port-out-pos port-in-pos)) (setq port-end-pos (vhdl-max-marker port-end-pos (vhdl-compose-insert-port signal-entry))) (setq port-out-pos (point-marker)) - (add-to-list 'written-list signal-name)) + (pushnew signal-name written-list :test #'equal)) ((or (member signal-name single-in-list) (member signal-name single-out-list)) (vhdl-goto-marker @@ -16576,12 +16585,12 @@ component instantiation." (vhdl-max-marker port-out-pos port-in-pos))) (setq port-end-pos (vhdl-compose-insert-port signal-entry)) (setq port-inst-pos (point-marker)) - (add-to-list 'written-list signal-name)) + (pushnew signal-name written-list :test #'equal)) ((equal (upcase (nth 2 signal-entry)) "OUT") (vhdl-goto-marker signal-pos) (vhdl-compose-insert-signal signal-entry) (setq signal-pos (point-marker)) - (add-to-list 'written-list signal-name))) + (pushnew signal-name written-list :test #'equal))) (setq signal-alist (cdr signal-alist))) (when (/= port-temp-pos port-inst-pos) (vhdl-goto-marker @@ -16932,7 +16941,7 @@ no project is defined." "Remove duplicate elements from IN-LIST." (let (out-list) (while in-list - (add-to-list 'out-list (car in-list)) + (pushnew (car in-list) out-list :test #'equal) (setq in-list (cdr in-list))) out-list))