From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: browse-url and URL handlers (MS-Windows) Date: Tue, 11 Oct 2022 19:36:50 +0300 Message-ID: <83ilkqe2ql.fsf@gnu.org> References: <825yh1b5si.fsf@gmail.com> <87czb61xv1.fsf@gnu.org> <82k056r7zw.fsf@gmail.com> <87fsfuee22.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24859"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pquessev@gmail.com, emacs-devel@gnu.org To: Augusto Stoffel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 11 18:38:00 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiIGV-0006H9-Ta for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Oct 2022 18:38:00 +0200 Original-Received: from localhost ([::1]:35844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiIGU-0001Iw-Kf for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Oct 2022 12:37:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiIFF-0000aG-IC for emacs-devel@gnu.org; Tue, 11 Oct 2022 12:36:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:52038) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiIFF-00051c-1Q; Tue, 11 Oct 2022 12:36:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=aRI3zZTTMY7/3TqMjJDQPCuW63xR75cE/B68KS5Em0Q=; b=dnEc4aTxmUUR NtN8vIFcWvsZx0IrUqNs87OIydXsd+y/NBTgK2x7KEvT/OliFZfLn4gh4bf2bsUBsBfHyzWaSQEWs XELRmbjbDR8Wm419KRl32BNnwMM7w/WE47ViHPCigsdkHA4reA3iLEg7YemmQBl0wMuyuyLWeCbh2 TiDEc0C7Xc/oq7g3/yVtamSy6Z5vs6/LYLt0yvZypg27CDqD1MVuB2mLYXFPnRkfot4h//T5jWKKd qjC1Kq8nkyeZWuYWWhmDDYxJVcG06aUUbbVCT3WiFj3iP4Q+R7566H5zsULx1AkA+ychVOQnMGq8F HFn/N+/xqn/EYkxpSyd5KQ==; Original-Received: from [87.69.77.57] (port=2745 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiIFE-0006yy-D5; Tue, 11 Oct 2022 12:36:40 -0400 In-Reply-To: <87fsfuee22.fsf@gmail.com> (message from Augusto Stoffel on Tue, 11 Oct 2022 14:32:21 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:297501 Archived-At: > From: Augusto Stoffel > Cc: emacs-devel@gnu.org > Date: Tue, 11 Oct 2022 14:32:21 +0200 > > > Type C-c C-c or C-c C-x to view the image as an image or hex. > > Cannot display image: ( *mm*-273075 1 8193) > > # > > > > I don't konw if this is because of the incorrectly reported read error > > when opening the file. When the file content is displayed in the > > buffer I can view the image with C-c C-c. > > I've come across issues with file URLs in Windows before, and the > problem was that > > (url-filename (url-generic-parse-url "file:///C:/some/file")) > > returns "/C:/some/file", with an extra slash at the beginning. Is the below the right fix? diff --git a/lisp/url/url-parse.el b/lisp/url/url-parse.el index 91f47d0..cc3e236 100644 --- a/lisp/url/url-parse.el +++ b/lisp/url/url-parse.el @@ -201,6 +201,9 @@ url-generic-parse-url (when (looking-at "\\?") (skip-chars-forward "^#")) (setq file (buffer-substring save-pos (point))) + (if (and (eq system-type 'windows-nt) + (string-match-p "/[A-Z]:/" file)) + (setq file (substring file 1))) ;; 3.5 Fragment (when (looking-at "#") (let ((opoint (point)))