From 351b838f618eb03697f1784539a059f388c81c96 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 26 Apr 2006 20:40:18 +0000 Subject: [PATCH] (url-open-stream): Don't hide errors. (url-gateway-nslookup-host, url-open-telnet): Use with-current-buffer. --- lisp/url/ChangeLog | 8 ++++++++ lisp/url/url-gw.el | 16 +++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 7d9e289e8e5..92bdf480e06 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,11 @@ +2006-04-26 Stefan Monnier + + * url-gw.el (url-open-stream): Don't hide errors. + (url-gateway-nslookup-host, url-open-telnet): Use with-current-buffer. + + * url-handlers.el (url-insert): New function. + (url-insert-file-contents): Use it. + 2006-03-29 Stefan Monnier * url-handlers.el (url-handler-directory-file-name): New handler. diff --git a/lisp/url/url-gw.el b/lisp/url/url-gw.el index 0cd2e6f9a50..878259927eb 100644 --- a/lisp/url/url-gw.el +++ b/lisp/url/url-gw.el @@ -118,8 +118,7 @@ linked Emacs under SunOS 4.x" url-gateway-nslookup-program host)) (res host)) (set-process-query-on-exit-flag proc nil) - (save-excursion - (set-buffer (process-buffer proc)) + (with-current-buffer (process-buffer proc) (while (memq (process-status proc) '(run open)) (accept-process-output proc)) (goto-char (point-min)) @@ -168,8 +167,7 @@ linked Emacs under SunOS 4.x" (defun url-open-telnet (name buffer host service) (if (not (stringp service)) (setq service (int-to-string service))) - (save-excursion - (set-buffer (get-buffer-create buffer)) + (with-current-buffer (get-buffer-create buffer) (erase-buffer) (let ((proc (start-process name buffer "telnet" "-8")) (case-fold-search t)) @@ -261,11 +259,15 @@ Will not make a connection if `url-gateway-unplugged' is non-nil." (otherwise (error "Bad setting of url-gateway-method: %s" url-gateway-method))))) - (error - (setq conn nil))) + ;; Ignoring errors here seems wrong. E.g. it'll throw away the + ;; error signalled two lines above. It was also found inconvenient + ;; during debugging. + ;; (error + ;; (setq conn nil)) + ) conn))) (provide 'url-gw) -;;; arch-tag: 1c4c0317-6d03-45b8-b3f3-838bd8f9d838 +;; arch-tag: 1c4c0317-6d03-45b8-b3f3-838bd8f9d838 ;;; url-gw.el ends here -- 2.39.2