From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pascal Quesseveur Newsgroups: gmane.emacs.devel Subject: browse-url and URL handlers (MS-Windows) Date: Mon, 03 Oct 2022 11:44:13 +0200 Organization: Les Enchantements de Miraldra Message-ID: <825yh1b5si.fsf@gmail.com> Reply-To: pquessev@gmail.com Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39146"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (windows-nt) To: emacs-devel@gnu.org Cancel-Lock: sha1:Mt7p4VBjOp9Tuo2zyZnFkduumj4= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 03 17:44:41 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 1ofNcW-0009vD-S5 for ged-emacs-devel@m.gmane-mx.org; Mon, 03 Oct 2022 17:44:40 +0200 Original-Received: from localhost ([::1]:56658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofNcV-0006mH-2E for ged-emacs-devel@m.gmane-mx.org; Mon, 03 Oct 2022 11:44:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofHzq-0002Ha-Af for emacs-devel@gnu.org; Mon, 03 Oct 2022 05:44:22 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:47348) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofHzo-00037H-TD for emacs-devel@gnu.org; Mon, 03 Oct 2022 05:44:22 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1ofHzm-000ANi-L7 for emacs-devel@gnu.org; Mon, 03 Oct 2022 11:44:18 +0200 X-Injected-Via-Gmane: http://gmane.org/ X-Attribution: PQsr Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 03 Oct 2022 11:42:47 -0400 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:296759 Archived-At: Hello, On MS-Windows I had set browse-url-browser-function to a custom function which calls 'rundll32 url.dll,FileProtocolHandler ...' to open the URL with the dedicated program. I had set that definition some years ago and I am pretty sure it worked. With 28.1 it appears that my function is no longer called. It seems to me it comes from the fact that browse-url uses browse-url-default-handlers which is defined as: (("\\`mailto:" . browse-url--mailto) ("\\`man:" . browse-url--man) (browse-url--non-html-file-url-p . browse-url-emacs)) That means that for a URL which is not identified as HTML browse-url calls browse-url-emacs. On my system that doesn't work when files are not ASCII file (PNG, RTF, ...). I can define browse-url-handlers to set a handler to open those files with an axternal program but I find it annoying. When called with a PREFIX browse-url calls browse-url-secondary-browser-function which calls browse-url-default-windows-browser. On MS-Windows that function calls the MS-Windows system's default Web browser (w32-shell-execute "open" ...) and everything works as expected. Why not always call browse-url-default-windows-browser in browse-url? If I want to open a certain type of file with emacs, I can configure the system to use emacsclient with that type of file. IMO things would be easier. -- Pascal Quesseveur pquessev@gmail.com