From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id aIASHujSzGXcSAAA62LTzQ:P1 (envelope-from ) for ; Wed, 14 Feb 2024 15:49:12 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id aIASHujSzGXcSAAA62LTzQ (envelope-from ) for ; Wed, 14 Feb 2024 15:49:12 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="A5Vw/C21"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707922152; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=oCq5JSLXNKRY2edrR49/t1Tr4atpJuswm55BZlxl/J0=; b=sX2T9cbNhA4SdxV9Z4ffmIB/4gjokB+TwAwZmTUReap6GJC2m0TsHXLEmjANu6XGUwWmhc Tp63Rd5JJaQh8HoFTqs+LmD0rXa/gE/V1swR3U6cx2/UBtNVGxwWlFiYy0UhkEm9lguBGo iAiy9+JtH3rqnf4nUN/pbidgpveNLyugoxk1C9AbVLVf1dt2BBTbGTS5iiJWgoaumMfh40 V7F8tdd6VpsyIDVptTYJELawKuvLNsiBFpwp5MAIzLKHYNjk50ojHmIURZNXqtrwNLLNt4 4v1otVl7fPJnXowsknwwxZFQWLlznyjJRTJ1cRbAd4B2h591FEQ6XXKVt59cKg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="A5Vw/C21"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707922152; a=rsa-sha256; cv=none; b=dJqjBpu8C+FMWR5HFtBa5Hx8/I5Ma8joMH0HEC9062JgpKIz3rZIyi3GozaBiYHQ6jeHky 6HUskQ6YYU38zt5ZlAemuuLLWrIkiFRMkMU8xDtxsCejfMgbI6MJzrDfABF0Jnq28iiqFN bfL20yGh9bXvNUIk/at1P97ws9dEF/vb/NZNQUTUJ761HoC1aPOseIYwADWYLifip+rIvt A4x2XOUxlYzML6HhYUjO1dekltDNc93PdwnIgomhwhoKRXDXv4Mk7ZJI3Ze5z197fbRKPN svaYsIOA2tqtvr0QDg0o0+OMYzw4723JnhU6J5FmJn1kk3VX2M88IaWqoEOEww== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 23F90394C1 for ; Wed, 14 Feb 2024 15:49:12 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raGYn-0002O2-5H; Wed, 14 Feb 2024 09:48:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raGYi-0002Nc-UO for emacs-orgmode@gnu.org; Wed, 14 Feb 2024 09:48:26 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raGYe-0001pM-OW for emacs-orgmode@gnu.org; Wed, 14 Feb 2024 09:48:23 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 71654240104 for ; Wed, 14 Feb 2024 15:48:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707922098; bh=/BUC2qTrPFSKPOwMOT3KaMofSCrGCNynH7sOqTqI/Xk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=A5Vw/C21DXQ4tXCWL3jfena+NdJrFIwz1aC3STNl+xzbPXPd4H1ErDgihSxso/RSd QBHAI2PpQYxaP8a81TaUZd0XdOLeODoJBXILLm7p4rMSYlnnUNEqU0jBv+kw19Q63x gciHeEV2OwBWsj9rKXP71BDivcRZYLqOp+Gl1hgAvucETVLNWdvVSACLS/5kMFwuCh L6a2oG1uRt7q8EIwAAB9oI+FfroQ8vuuoyJy3ZSZPE7Dkt/iiXrAt7Q5HEKl/uMfO2 cq42XFY7L9YFuY5CNedTTwMaynwcYk81GFVsCN4azJz+PiJcdZa7QbtiPcNSQvOCQK vR3OjaIGikjNg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TZgzj34SXz9rxG; Wed, 14 Feb 2024 15:48:17 +0100 (CET) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [DISCUSSION, default settings] Using mailcap as default handler for opening file links In-Reply-To: References: <963d5f94-3fdf-a01b-bc91-edc99222cb34@gmail.com> <877d6j2htv.fsf@localhost> <87ilq14p6p.fsf@localhost> <87v8u0396t.fsf@localhost> <87ilpz3bi0.fsf@localhost> <87h75ip5r6.fsf@localhost> <87zgj46hwo.fsf@localhost> <8735gr15ok.fsf@localhost> <878rqcy27h.fsf@localhost> <874jedoo4d.fsf@localhost> <87bk8kwqmu.fsf@localhost> Date: Wed, 14 Feb 2024 14:51:53 +0000 Message-ID: <875xyrt7xy.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -8.20 X-Spam-Score: -8.20 X-Migadu-Queue-Id: 23F90394C1 X-Migadu-Scanner: mx13.migadu.com X-TUID: 4bMyjitGTTPm Max Nikulin writes: > On 13/02/2024 18:27, Ihor Radchenko wrote: >> Max Nikulin writes: >> >> I am mostly going to address user confusion about mailcap > > XDG configuration and so xdg-open behavior is often confusing to users > as well, especially in the cases of KDE and no DE. In GNOME it is > alleviated by a step with the application chooser if default application > has not been set yet. I'd say that it is less confusing. Of course, if you know anything even less confusing than xdg-open, please share. >> (2) Emacs' mailcap does not implement the specification fully - only a >> subset of mailcap format is obeyed. > > Agree. On the other hand, mailcap.el is aware that Emacs can handle some > files internally. This feature should be preserved in some way. In > addition, mailcap has to be used if neither DISPLAY nor WAYLAND_DISPLAY > is set for current terminal. May you please explain more about this? What happens if a mailcap entry, say, declares "less" as a mimetype handler and Emacs is running in terminal? Also, I tried to run xdg-open from terminal (not emulator - C-M- on Linux) and it runs w3m for .png image vs. feh when running from terminal emulator on X. >>> xdg-mime is more close to the file(1) tool >> >> That might be a good alternative to file indeed; although file is >> probably more widely installed. > > xdg-mime and xdg-open belong to the same package. In the case of no DE > xdg-mime calls file(1) (if mimetype(1) is not installed). So, we can try xdg-mime and fall back to file. >> Yes, but mailcap is not documented in Emacs manual. > > (info "emacs-mailcap") However it is not as useful as it should be. It is not expected to be read by Emacs users: This manual is directed at users who want to modify the behaviour of the MIME encoding/decoding process or want a more detailed picture of how the Emacs MIME library works, and people who want to write functions and commands that manipulate MIME elements. So, I'd say that ordinary Emacs user probably has no idea that Emacs consults .mailcap to open /files/. Maybe some users (who are already familiar with .mailcap) expect .mailcap to be consulted when opening email attachments. But I am not sure - even reading https://man.archlinux.org/man/mailcap.5.en I cannot easily see why this would be used to open files; not to render them inline. >>> Is it necessary to modify Org? Maybe an alternative is to add "xdg-open >>> %s" for */* to `mailcap-user-mime-data'. >> >> Do you mean changing the default value of `mailcap-mime-data'? > > I am unsure what is a proper way to do it. I am not confident enough > with the code that selects handlers for files. I feel that we are abusing the scope of mailcap when opening file links. >>> I am still not really comfortable due to the strategy to start external >>> processes diverged from methods used in browse-url.el. >> >> Is it related to the problem at hand? > > - Eli had objections, but did not provide any details. > - Error handling code was dropped for the sake of Emacs-25. > - In the case of no DE, quit from emacs means terminating of started > applications. > - I hope a bug I faced is exotic enough to never happen in real life. > > Unfortunately another approach is a kind of trade-off, not an > unambiguous advantage. Sorry, but I have no idea what you are talking about. I assume that it is some kind of Emacs bug you reported some time ago. I am not sure which one. And I do not see how it is related to this discussion. >> AFAIK, xdg.el does not support xdg-open functionality. We cannot use it >> here. > > `xdg-mime-apps' looks like a building block. However it is not enough > and perhaps has enough bugs. > > Ideally Emacs should provide API that uses either xdg.el or mailcap.el > as backend depending on runtime and user configuration. Org is not the > only package that needs it. Yes. But that's a lot of work; adding support of libmagic being just the first step. Implementing something more reasonable for Org mode only is a lower-handing fruit. > P.S. > Ihor, perhaps your clock is several minutes ahead. I know. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at