commit 213bcaf1bf365d0d40639754b8123f9d770b08e8 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Wed Sep 25 11:09:09 2019 +0300 ; * lisp/emacs-lisp/debug.el (debugger-mode): Doc fix. (Bug#37352) diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 21499f7579..f711971c18 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -588,12 +588,15 @@ The environment used is the one when entering the activation frame at point." (define-derived-mode debugger-mode backtrace-mode "Debugger" "Mode for debugging Emacs Lisp using a backtrace. \\ -A line starts with `*' if exiting that frame will call the debugger. -Type \\[debugger-frame] or \\[debugger-frame-clear] to set or remove the `*'. - -When in debugger due to frame being exited, -use the \\[debugger-return-value] command to override the value -being returned from that frame. +A frame marked with `*' in the backtrace means that exiting that +frame will enter the debugger. You can flag frames to enter the +debugger when frame is exited with \\[debugger-frame], and remove +the flag with \\[debugger-frame-clear]. + +When in debugger invoked due to exiting a frame which was flagged +with a `*', you can use the \\[debugger-return-value] command to +override the value being returned from that frame when the debugger +exits. Use \\[debug-on-entry] and \\[cancel-debug-on-entry] to control which functions will enter the debugger when called. commit 13f244af4044bf250307889bd6cd974ee665d01a Author: Lars Ingebrigtsen Date: Tue Sep 24 19:47:20 2019 +0200 Make ImageMagick multi-image size calculations work for .ico files * src/image.c (imagemagick_load_image): Compute image sizes correctly in multi-image .ico files and the like (bug#18333). diff --git a/src/image.c b/src/image.c index 06a8154842..7cf1bc4c36 100644 --- a/src/image.c +++ b/src/image.c @@ -8896,12 +8896,28 @@ imagemagick_load_image (struct frame *f, struct image *img, "super-wand". */ if (MagickGetNumberImages (image_wand) > 1) { - MagickWand *super_wand = image_wand; - image_wand = imagemagick_compute_animated_image (super_wand, ino); - if (! image_wand) - image_wand = super_wand; + /* This is an animated image (it has a delay), so compute the + composite image etc. */ + if (MagickGetImageDelay (image_wand) > 0) + { + MagickWand *super_wand = image_wand; + image_wand = imagemagick_compute_animated_image (super_wand, ino); + if (! image_wand) + image_wand = super_wand; + else + DestroyMagickWand (super_wand); + } else - DestroyMagickWand (super_wand); + /* This is not an animated image: It's just a multi-image file + (like an .ico file). Just return the correct + sub-image. */ + { + MagickWand *super_wand = image_wand; + + MagickSetIteratorIndex (super_wand, ino); + image_wand = MagickGetImage (super_wand); + DestroyMagickWand (super_wand); + } } /* Retrieve the frame's background color, for use later. */ commit 7823dcf2fb0ac2bd1d0349be683a618d332758ff Author: Lars Ingebrigtsen Date: Tue Sep 24 19:38:16 2019 +0200 Slight shr-put-image clean up * lisp/net/shr.el (shr-put-image): Use image-multi-frame-p directly, and remove outdated comments (image-multi-frame-p returns the delay). diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 63988d01c8..0cd15dcfe0 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1088,13 +1088,7 @@ element is the data blob and the second element is the content-type." (insert-image image (or alt "*"))) (put-text-property start (point) 'image-size size) (when (and shr-image-animate - (cond ((fboundp 'image-multi-frame-p) - ;; Only animate multi-frame things that specify a - ;; delay; eg animated gifs as opposed to - ;; multi-page tiffs. FIXME? - (cdr (image-multi-frame-p image))) - ((fboundp 'image-animated-p) - (image-animated-p image)))) + (cdr (image-multi-frame-p image))) (image-animate image nil 60))) image) (insert (or alt "")))) commit ef0fc0bed1c97a1c803fa83bee438ca9cfd238b0 Author: Alan Mackenzie Date: Tue Sep 24 17:04:12 2019 +0000 New edebug-spec, nested-backquote-form. This fixes bug #31090 * lisp/emacs-lisp/edebug.el: (nested-backquote-form): a new edebug-spec which handles nested backquote structures without a , or ,@ "between" the outer and inner backquotes. (backquote-form): Use nested-backquote-form. diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index c898da3d39..717026995a 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -2165,6 +2165,9 @@ into `edebug--cl-macrolet-defs' which is checked in `edebug-list-form-args'." ;; but only at the top level inside unquotes. (def-edebug-spec backquote-form (&or + ;; Disallow instrumentation of , and ,@ inside a nested backquote, since + ;; these are likely to be forms generated by a macro being debugged. + ("`" nested-backquote-form) ([&or "," ",@"] &or ("quote" backquote-form) form) ;; The simple version: ;; (backquote-form &rest backquote-form) @@ -2180,6 +2183,16 @@ into `edebug--cl-macrolet-defs' which is checked in `edebug-list-form-args'." (vector &rest backquote-form) sexp)) +(def-edebug-spec nested-backquote-form + (&or + ;; Allow instrumentation of any , or ,@ contained within the (\, ...) or + ;; (\,@ ...) matched on the next line. + ([&or "," ",@"] backquote-form) + (nested-backquote-form [&rest [¬ "," ",@"] nested-backquote-form] + . [&or nil nested-backquote-form]) + (vector &rest nested-backquote-form) + sexp)) + ;; Special version of backquote that instruments backquoted forms ;; destined to be evaluated, usually as the result of a ;; macroexpansion. Backquoted code can only have unquotes (, and ,@) commit 9a82195cfcafd3003fc971b71ab401b37ecc0930 Author: Lars Ingebrigtsen Date: Tue Sep 24 19:01:51 2019 +0200 Make --with-imagemagick bug out if there's no support for it * configure.ac (HAVE_IMAGEMAGICK): Stop configuration if the user has said --with-imagemagick, but there's no support for it (bug#24455). diff --git a/configure.ac b/configure.ac index e822b0b7b0..7435f2e8da 100644 --- a/configure.ac +++ b/configure.ac @@ -2638,6 +2638,9 @@ if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" if test $HAVE_IMAGEMAGICK = yes; then AC_DEFINE([HAVE_IMAGEMAGICK], 1, [Define to 1 if using ImageMagick.]) else + if test "${with_imagemagick}" != "no"; then + AC_MSG_ERROR([ImageMagick wanted, but it does not compile. Maybe some library files are missing?]); + fi IMAGEMAGICK_CFLAGS= IMAGEMAGICK_LIBS= fi commit 873cd63ff2a2fc738664065e84a997fe7b4e7051 Author: Pip Cet Date: Tue Sep 24 18:35:15 2019 +0200 Allow a :stride argument so XBM boolvecs are in the right format. * src/image.c (xbm_image_p): Explicitly specify the right stride if a bool vector is used as argument. * doc/lispref/display.texi (XBM Images): Describe bool vectors accurately. * etc/NEWS: Document the change (bug#36337). diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 3c3ee1fc6a..fd6820897f 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -5446,12 +5446,14 @@ because omitting them is what indicates the data has the format of an XBM file. The file contents specify the height and width of the image. @item -A string or a bool-vector containing the bits of the image (plus perhaps -some extra bits at the end that will not be used). It should contain at -least @var{width} * @code{height} bits. In this case, you must specify -@code{:height} and @code{:width}, both to indicate that the string -contains just the bits rather than a whole XBM file, and to specify the -size of the image. +A string or a bool-vector containing the bits of the image (plus +perhaps some extra bits at the end that will not be used). It should +contain at least @w{@code{@var{stride} * @var{height}}} bits, where +@var{stride} is the smallest multiple of 8 greater than or equal to +the width of the image. In this case, you should specify +@code{:height}, @code{:width} and @code{:stride}, both to indicate +that the string contains just the bits rather than a whole XBM file, +and to specify the size of the image. @end itemize @item :width @var{width} @@ -5459,6 +5461,10 @@ The value, @var{width}, specifies the width of the image, in pixels. @item :height @var{height} The value, @var{height}, specifies the height of the image, in pixels. + +@item :stride @var{stride} +The number of bool vector entries stored for each row; the smallest +multiple of 8 greater than or equal to @var{width}. @end table @node XPM Images diff --git a/etc/NEWS b/etc/NEWS index 50956f4082..3072d4081b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2152,6 +2152,11 @@ valid event type. --- ** The obsolete package xesam.el (since Emacs 24) has been removed. ++++ +** The XBM image handler now accepts a ':stride' argument, which should +be specified in image specs representing the entire bitmap as a single +bool vector. + * Lisp Changes in Emacs 27.1 diff --git a/src/image.c b/src/image.c index d9b7101d65..06a8154842 100644 --- a/src/image.c +++ b/src/image.c @@ -3028,6 +3028,7 @@ enum xbm_keyword_index XBM_FILE, XBM_WIDTH, XBM_HEIGHT, + XBM_STRIDE, XBM_DATA, XBM_FOREGROUND, XBM_BACKGROUND, @@ -3049,6 +3050,7 @@ static const struct image_keyword xbm_format[XBM_LAST] = {":file", IMAGE_STRING_VALUE, 0}, {":width", IMAGE_POSITIVE_INTEGER_VALUE, 0}, {":height", IMAGE_POSITIVE_INTEGER_VALUE, 0}, + {":stride", IMAGE_POSITIVE_INTEGER_VALUE, 0}, {":data", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, @@ -3124,7 +3126,7 @@ xbm_image_p (Lisp_Object object) else { Lisp_Object data; - int width, height; + int width, height, stride; /* Entries for `:width', `:height' and `:data' must be present. */ if (!kw[XBM_WIDTH].count @@ -3136,6 +3138,11 @@ xbm_image_p (Lisp_Object object) width = XFIXNAT (kw[XBM_WIDTH].value); height = XFIXNAT (kw[XBM_HEIGHT].value); + if (!kw[XBM_STRIDE].count) + stride = width; + else + stride = XFIXNAT (kw[XBM_STRIDE].value); + /* Check type of data, and width and height against contents of data. */ if (VECTORP (data)) @@ -3154,8 +3161,7 @@ xbm_image_p (Lisp_Object object) if (STRINGP (elt)) { - if (SCHARS (elt) - < (width + CHAR_BIT - 1) / CHAR_BIT) + if (SCHARS (elt) < stride / CHAR_BIT) return 0; } else if (BOOL_VECTOR_P (elt)) @@ -3169,13 +3175,16 @@ xbm_image_p (Lisp_Object object) } else if (STRINGP (data)) { - if (SCHARS (data) - < (width + CHAR_BIT - 1) / CHAR_BIT * height) + if (SCHARS (data) < stride / CHAR_BIT * height) return 0; } else if (BOOL_VECTOR_P (data)) { - if (bool_vector_size (data) / height < width) + if (height > 1 && stride != (width + CHAR_BIT - 1) + / CHAR_BIT * CHAR_BIT) + return 0; + + if (bool_vector_size (data) / height < stride) return 0; } else commit 38517651d0aa573b0af69d1c70e920b587930c4f Author: Michael Albinus Date: Tue Sep 24 17:56:55 2019 +0200 * lisp/net/tramp-sh.el (tramp-get-remote-stat): Ban "stat" on Solaris. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index b7089207cb..a53eea429d 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -5528,25 +5528,30 @@ Nonexistent directories are removed from spec." (defun tramp-get-remote-stat (vec) "Determine remote `stat' command." (with-tramp-connection-property vec "stat" - (tramp-message vec 5 "Finding a suitable `stat' command") - (let ((result (tramp-find-executable - vec "stat" (tramp-get-remote-path vec))) - tmp) - ;; Check whether stat(1) returns usable syntax. "%s" does not - ;; work on older AIX systems. Recent GNU stat versions (8.24?) - ;; use shell quoted format for "%N", we check the boundaries "`" - ;; and "'", therefore. See Bug#23422 in coreutils. - ;; Since GNU stat 8.26, environment variable QUOTING_STYLE is - ;; supported. - (when result - (setq result (concat "env QUOTING_STYLE=locale " result) - tmp (tramp-send-command-and-read - vec (format "%s -c '(\"%%N\" %%s)' /" result) 'noerror)) - (unless (and (listp tmp) (stringp (car tmp)) - (string-match-p "^\\(`/'\\|‘/’\\)$" (car tmp)) - (integerp (cadr tmp))) - (setq result nil))) - result))) + ;; stat on Solaris is buggy. We've got reports for "SunOS 5.10" + ;; and "SunOS 5.11" so far. + (unless (string-match-p + (eval-when-compile (regexp-opt '("SunOS 5.10" "SunOS 5.11"))) + (tramp-get-connection-property vec "uname" "")) + (tramp-message vec 5 "Finding a suitable `stat' command") + (let ((result (tramp-find-executable + vec "stat" (tramp-get-remote-path vec))) + tmp) + ;; Check whether stat(1) returns usable syntax. "%s" does not + ;; work on older AIX systems. Recent GNU stat versions + ;; (8.24?) use shell quoted format for "%N", we check the + ;; boundaries "`" and "'", therefore. See Bug#23422 in + ;; coreutils. Since GNU stat 8.26, environment variable + ;; QUOTING_STYLE is supported. + (when result + (setq result (concat "env QUOTING_STYLE=locale " result) + tmp (tramp-send-command-and-read + vec (format "%s -c '(\"%%N\" %%s)' /" result) 'noerror)) + (unless (and (listp tmp) (stringp (car tmp)) + (string-match-p "^\\(`/'\\|‘/’\\)$" (car tmp)) + (integerp (cadr tmp))) + (setq result nil))) + result)))) (defun tramp-get-remote-readlink (vec) "Determine remote `readlink' command." commit 88ca4dc45b7c4ba950eb37817e9abcdd2770a3ae Author: Noah Swainland Date: Tue Sep 24 17:52:10 2019 +0200 (calc): Fix link in doc string * lisp/calc/calc.el (calc): Fix link in doc string (bug#37500). Copyright-paperwork-exempt: yes diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 8e76296273..ad483b406d 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -1394,7 +1394,7 @@ commands given here will actually operate on the *Calculator* stack." ;;;###autoload (defun calc (&optional arg full-display interactive) - "The Emacs Calculator. Full documentation is listed under \"calc-mode\"." + "The Emacs Calculator. Full documentation is listed under `calc-mode'." (interactive "P\ni\np") (if arg (unless (eq arg 0) commit ea5c79f657a9e2826073896ea00e6000ccc04a8d Author: Lars Ingebrigtsen Date: Tue Sep 24 17:48:35 2019 +0200 Allow controlling when to send cookies when retrieving images in shr * lisp/net/shr.el (shr--use-cookies-p): New function. (shr-tag-img): Use it. (shr-cookie-policy): New variable. (shr-save-contents): Use cookies. * doc/misc/eww.texi (Advanced): Document it. diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index 315b4b0194..b8821cbc29 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -217,9 +217,22 @@ in an external browser by customizing @findex url-cookie-list @kindex C @cindex Cookies - EWW handles cookies through the @ref{Top, url package, ,url}. -You can list existing cookies with @kbd{C} (@code{url-cookie-list}). -For details about the Cookie handling @xref{Cookies,,,url}. + EWW handles cookies through the @ref{Top, url package, ,url} +package. You can list existing cookies with @kbd{C} +(@code{url-cookie-list}). For details about the Cookie handling +@xref{Cookies,,,url}. + +@vindex shr-cookie-policy + Many @acronym{HTML} pages have images embedded in them, and EWW will +download most these by default. When fetching images, cookies can be +sent and received, and these can be used to track users. To control +when to send cookies when retrieving these images, the +@code{shr-cookie-policy} variable can be used. The default value, +@code{same-origin}, means that EWW will only send cookies when +fetching images that originate from the same source as the +@acronym{HTML} page. @code{nil} means ``never send cookies when +retrieving these images'' and @code{t} means ``always send cookies +when retrieving these images''. @vindex eww-header-line-format @cindex Header diff --git a/etc/NEWS b/etc/NEWS index 3f38f9f4a1..50956f4082 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1117,6 +1117,12 @@ The variable to use instead to alter text to be sent is now ** eww/shr ++++ +*** The new variable 'shr-cookie-policy' can be used to control when +to use cookies when fetching embedded images. The default is to use +them when the images are from the same domain as the main HTML +document. + +++ *** The 'eww' command can now create a new EWW buffer. Invoking the command with a prefix argument will cause it to create a diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 2e4f7fa5c6..63988d01c8 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -39,6 +39,7 @@ (require 'svg) (require 'image) (require 'puny) +(require 'url-cookie) (require 'text-property-search) (defgroup shr nil @@ -111,6 +112,16 @@ Alternative suggestions are: :version "24.4" :type 'string) +(defcustom shr-cookie-policy 'same-origin + "When to use cookies when fetching dependent data like images. +If t, always use cookies. If nil, never use cookies. If +`same-origin', use cookies if the dependent data comes from the +same domain as the main data." + :type '(choice (const :tag "Always use cookies" t) + (const :tag "Never use cookies" nil) + (const :tag "Use cookies for same domain" same-origin)) + :version "27.1") + (define-obsolete-variable-alias 'shr-external-browser 'browse-url-secondary-browser-function "27.1") @@ -333,7 +344,7 @@ called." ;; Remove common tracking junk from the URL. (funcall cont (replace-regexp-in-string ".utm_.*" "" destination))))) - nil t)) + nil t t)) (defun shr-probe-and-copy-url (url) "Copy the URL under point to the kill ring. @@ -427,7 +438,7 @@ the URL of the image to the kill buffer instead." (message "Inserting %s..." url) (url-retrieve url 'shr-image-fetched (list (current-buffer) (1- (point)) (point-marker)) - t t)))) + t)))) (defun shr-zoom-image () "Toggle the image size. @@ -985,8 +996,7 @@ the mouse click event." (if (not url) (message "No link under point") (url-retrieve (shr-encode-url url) - 'shr-store-contents (list url directory) - nil t)))) + 'shr-store-contents (list url directory))))) (defun shr-store-contents (status url directory) (unless (plist-get status :error) @@ -1658,7 +1668,8 @@ The preference is a float determined from `shr-prefer-media-type'." (shr-encode-url url) 'shr-image-fetched (list (current-buffer) start (set-marker (make-marker) (point)) (list :width width :height height)) - t t))) + t + (not (shr--use-cookies-p url shr-base))))) (when (zerop shr-table-depth) ;; We are not in a table. (put-text-property start (point) 'keymap shr-image-map) (put-text-property start (point) 'shr-alt alt) @@ -1669,6 +1680,30 @@ The preference is a float determined from `shr-prefer-media-type'." (shr-fill-text (or (dom-attr dom 'title) alt)))))))) +(defun shr--use-cookies-p (url base) + "Say whether to use cookies when fetching URL (typically an image). +BASE is the URL of the HTML being rendered." + (cond + ((null base) + ;; Disallow cookies if we don't know what the base is. + nil) + ((eq shr-cookie-policy 'same-origin) + (let ((url-host (url-host (url-generic-parse-url url))) + (base-host (split-string + (url-host (url-generic-parse-url (car base))) + "\\."))) + ;; We allow cookies if it's for any of the sibling domains (that + ;; we're allowed to set cookies for). Determine that by going + ;; "upwards" in the base domain name. + (cl-loop while base-host + when (url-cookie-host-can-set-p + url-host (mapconcat #'identity base-host ".")) + return t + do (pop base-host) + finally (return nil)))) + (t + shr-cookie-policy))) + (defun shr--preferred-image (dom) (let ((srcset (dom-attr dom 'srcset)) (frame-width (frame-pixel-width)) diff --git a/test/lisp/net/shr-tests.el b/test/lisp/net/shr-tests.el index dd820e2d9f..c3be36439e 100644 --- a/test/lisp/net/shr-tests.el +++ b/test/lisp/net/shr-tests.el @@ -53,6 +53,19 @@ (unless (equal (car result) (cdr result)) (should (not (list name (car result) (cdr result)))))))) +(ert-deftest use-cookies () + (let ((shr-cookie-policy 'same-origin)) + (should + (shr--use-cookies-p "http://images.fsf.org" '("http://www.fsf.org"))) + (should + (shr--use-cookies-p "http://www.fsf.org" '("https://www.fsf.org"))) + (should + (shr--use-cookies-p "http://www.fsf.org" '("https://www.fsf.org"))) + (should + (shr--use-cookies-p "http://www.fsf.org" '("http://fsf.org"))) + (should-not + (shr--use-cookies-p "http://www.gnu.org" '("http://www.fsf.org"))))) + (require 'shr) ;;; shr-stream-tests.el ends here commit 9dcdb1384df51a568af5ec35c9f0a762d3cf205b Author: Robert Pluim Date: Tue Sep 24 13:52:48 2019 +0200 Document how to listen on all interfaces in the Elisp manual * doc/lispref/processes.texi (Network Processes): Explain how to listen on all interfaces. diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 2ba5b1c893..287221a184 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -2685,7 +2685,11 @@ the local host. If you specify @var{host} for a server, it must specify a valid address for the local host, and only clients connecting to that address will be accepted. When using @code{local}, by default IPv4 will be used, specify a @var{family} of @code{ipv6} to -override this. +override this. To listen on all interfaces, specify an address of +@samp{"0.0.0.0"} for IPv4 or @samp{"::"} for IPv6. Note that on some +operating systems, listening on @samp{"::"} will also listen on IPv4, +so attempting to then listen separately on IPv4 will result in +@code{EADDRINUSE} errors (@samp{"Address already in use"}). @item :service @var{service} @var{service} specifies a port number to connect to; or, for a server, commit bc5472a4ee4f139439f22dddd2339ce1d907da45 Author: Eli Zaretskii Date: Tue Sep 24 11:49:12 2019 +0300 ; Fix typo in recently fixed doc string * src/process.c (Fmake_network_process): Fix capitalization in doc string. diff --git a/src/process.c b/src/process.c index b7ab0b9fe0..af282652eb 100644 --- a/src/process.c +++ b/src/process.c @@ -3759,8 +3759,8 @@ address. The symbol `local' specifies the local host. If specified for a server process, it must be a valid name or address for the local host, and only clients connecting to that address will be accepted. If all interfaces should be bound, an address of \"0.0.0.0\" (for -ipv4) or \"::\" (for ipv6) can be used. (On some operating systems, -using \"::\" listens on both ipv4 and ipv6.) `local' will use IPv4 by +IPv4) or \"::\" (for IPv6) can be used. (On some operating systems, +using \"::\" listens on both IPv4 and IPv6.) `local' will use IPv4 by default, use a FAMILY of 'ipv6 to override this. :service SERVICE -- SERVICE is name of the service desired, or an commit f9f8dcae704b14fde484d7bfd8805d2cd3e5ab5d Author: Lars Ingebrigtsen Date: Tue Sep 24 10:43:28 2019 +0200 Allow url-insert-file-contents to work on 304 responses * lisp/url/url-http.el (url-http--insert-file-helper): If the server answers 304 Not modified, then that's not an error (bug#26063). diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index a6963cef70..31c866bd66 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -551,8 +551,9 @@ work correctly." ;; display a file buffer even if the URL does not exist and ;; 'url-retrieve-synchronously' returns 404 or whatever. (unless (or visit - (and (>= url-http-response-status 200) - (< url-http-response-status 300))) + (or (and (>= url-http-response-status 200) + (< url-http-response-status 300)) + (= url-http-response-status 304))) ; "Not modified" (let ((desc (nth 2 (assq url-http-response-status url-http-codes)))) (kill-buffer buffer) ;; Signal file-error per bug#16733. commit 881f6209306ed59284eb04b3812536b7a2b91595 Author: Lars Ingebrigtsen Date: Tue Sep 24 10:07:26 2019 +0200 Clean up url-parse-args slightly * lisp/url/url-util.el (url-parse-args): Don't leave temporary buffer behind. Clean up slightly. diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el index 0b3c283926..a390723e73 100644 --- a/lisp/url/url-util.el +++ b/lisp/url/url-util.el @@ -74,60 +74,49 @@ If a list, it is a list of the types of messages to be logged." (defun url-parse-args (str &optional nodowncase) ;; Return an assoc list of attribute/value pairs from a string ;; that uses RFC 822 (or later) format. - (let ( - name ; From name= + (let (name ; From name= value ; its value results ; Assoc list of results name-pos ; Start of XXXX= position - val-pos ; Start of value position - st - nd - ) - (save-excursion - (save-restriction - (set-buffer (get-buffer-create " *urlparse-temp*")) - (set-syntax-table url-parse-args-syntax-table) - (erase-buffer) - (insert str) - (setq st (point-min) - nd (point-max)) - (set-syntax-table url-parse-args-syntax-table) - (narrow-to-region st nd) - (goto-char (point-min)) - (while (not (eobp)) - (skip-chars-forward "; \n\t") - (setq name-pos (point)) - (skip-chars-forward "^ \n\t=;") - (if (not nodowncase) - (downcase-region name-pos (point))) - (setq name (buffer-substring name-pos (point))) - (skip-chars-forward " \t\n") - (if (/= (or (char-after (point)) 0) ?=) ; There is no value - (setq value nil) - (skip-chars-forward " \t\n=") - (setq val-pos (point) - value - (cond - ((or (= (or (char-after val-pos) 0) ?\") - (= (or (char-after val-pos) 0) ?')) - (buffer-substring (1+ val-pos) - (condition-case () - (prog2 - (forward-sexp 1) - (1- (point)) - (skip-chars-forward "\"")) - (error - (skip-chars-forward "^ \t\n") - (point))))) - (t - (buffer-substring val-pos - (progn - (skip-chars-forward "^;") - (skip-chars-backward " \t") - (point))))))) - (setq results (cons (cons name value) results)) - (skip-chars-forward "; \n\t")) - results)))) + val-pos) ; Start of value position + (with-temp-buffer + (insert str) + (set-syntax-table url-parse-args-syntax-table) + (goto-char (point-min)) + (while (not (eobp)) + (skip-chars-forward "; \n\t") + (setq name-pos (point)) + (skip-chars-forward "^ \n\t=;") + (unless nodowncase + (downcase-region name-pos (point))) + (setq name (buffer-substring name-pos (point))) + (skip-chars-forward " \t\n") + (if (/= (or (char-after (point)) 0) ?=) ; There is no value + (setq value nil) + (skip-chars-forward " \t\n=") + (setq val-pos (point) + value + (cond + ((or (= (or (char-after val-pos) 0) ?\") + (= (or (char-after val-pos) 0) ?')) + (buffer-substring (1+ val-pos) + (condition-case () + (prog2 + (forward-sexp 1) + (1- (point)) + (skip-chars-forward "\"")) + (error + (skip-chars-forward "^ \t\n") + (point))))) + (t + (buffer-substring val-pos + (progn + (skip-chars-forward "^;") + (skip-chars-backward " \t") + (point))))))) + (setq results (cons (cons name value) results)) + (skip-chars-forward "; \n\t")) + results))) ;;;###autoload (defun url-insert-entities-in-string (string)