From: Leo Liu <sdl.web@gmail.com>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: 17549@debbugs.gnu.org
Subject: bug#17549: 24.4.50; regression: url-insert-file-contents
Date: Wed, 25 Jun 2014 08:58:49 +0800 [thread overview]
Message-ID: <m3vbrpajp2.fsf@gmail.com> (raw)
In-Reply-To: <CAAeL0SRfPJfHAzg62_GiEVxRc523nSnn7m0VPhVNDYnL3Miztg@mail.gmail.com> (Juanma Barranquero's message of "Tue, 24 Jun 2014 16:01:35 +0200")
On 2014-06-24 16:01 +0200, Juanma Barranquero wrote:
> Sorry. I keep trying to find time to fix this and a few other bugs, but I'm
> very busy right now.
No worries ;)
> AFAIR, originally I wanted a small change, just throw an error in a
> specific case, and Stefan pushed for a bigger (though, I suppose, cleaner)
> fix; there was some back-and-forth and we finally settled on what's
> installed. So perhaps you can go back, reread the bug thread and find
> something in the proposed solutions that fixes the original problem and
> does not cause the one you're reporting.
OK, I read that thread quickly and now understood the decision. I
propose the following solution for now. The patch introduces a compiler
warning on url-http-codes. How best to suppress it?
=== modified file 'lisp/url/url-handlers.el'
--- lisp/url/url-handlers.el 2014-05-12 06:59:30 +0000
+++ lisp/url/url-handlers.el 2014-06-25 00:41:33 +0000
@@ -33,7 +33,6 @@
(autoload 'url-expand-file-name "url-expand" "Convert url to a fully specified url, and canonicalize it.")
(autoload 'mm-dissect-buffer "mm-decode" "Dissect the current buffer and return a list of MIME handles.")
(autoload 'url-scheme-get-property "url-methods" "Get property of a URL SCHEME.")
-(autoload 'url-http-parse-response "url-http" "Parse just the response code.")
;; Always used after mm-dissect-buffer and defined in the same file.
(declare-function mm-save-part-to-file "mm-decode" (handle file))
@@ -313,12 +312,12 @@
(let ((buffer (url-retrieve-synchronously url)))
(unless buffer (signal 'file-error (list url "No Data")))
(with-current-buffer buffer
- (let ((response (url-http-parse-response)))
- (if (and (>= response 200) (< response 300))
- (goto-char (point-min))
- (let ((desc (buffer-substring-no-properties (1+ (point))
- (line-end-position))))
+ (when (bound-and-true-p url-http-response-status)
+ (unless (and (>= url-http-response-status 200)
+ (< url-http-response-status 300))
+ (let ((desc (nth 2 (assq url-http-response-status url-http-codes))))
(kill-buffer buffer)
+ ;; Signal file-error per http://debbugs.gnu.org/16733.
(signal 'file-error (list url desc))))))
(if visit (setq buffer-file-name url))
(save-excursion
@@ -333,6 +332,7 @@
;; usual heuristic/rules that we apply to files.
(decode-coding-inserted-region start (point) url visit beg end replace))
(list url (car size-and-charset))))))
+
(put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents)
(defun url-file-name-completion (url directory &optional predicate)
=== modified file 'lisp/url/url-http.el'
--- lisp/url/url-http.el 2014-03-29 00:55:44 +0000
+++ lisp/url/url-http.el 2014-06-25 00:23:24 +0000
@@ -48,7 +48,6 @@
(defvar url-http-response-version)
(defvar url-http-target-url)
(defvar url-http-transfer-encoding)
-(defvar url-http-end-of-headers)
(defvar url-show-status)
(require 'url-gw)
next prev parent reply other threads:[~2014-06-25 0:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-22 11:11 bug#17549: 24.4.50; regression: url-insert-file-contents Leo Liu
2014-05-29 23:24 ` Leo Liu
2014-05-30 2:09 ` Juanma Barranquero
2014-06-24 3:24 ` Leo Liu
2014-06-24 12:49 ` Stefan Monnier
2014-06-24 12:58 ` Juanma Barranquero
2014-06-24 13:38 ` Leo Liu
2014-06-24 14:01 ` Juanma Barranquero
2014-06-25 0:58 ` Leo Liu [this message]
2014-06-26 0:19 ` Leo Liu
2014-06-26 2:38 ` Stefan Monnier
2014-06-26 4:03 ` Leo Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3vbrpajp2.fsf@gmail.com \
--to=sdl.web@gmail.com \
--cc=17549@debbugs.gnu.org \
--cc=lekktu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.