From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yIgDCxSwt2CMLAAAgWs5BA (envelope-from ) for ; Wed, 02 Jun 2021 18:21:40 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id UNIYBhSwt2B1QQAAbx9fmQ (envelope-from ) for ; Wed, 02 Jun 2021 16:21:40 +0000 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 6DD35A9EC for ; Wed, 2 Jun 2021 18:21:39 +0200 (CEST) Received: from localhost ([::1]:59238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1loTcf-0005BS-Da for larch@yhetil.org; Wed, 02 Jun 2021 12:21:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loTc6-0005Al-LI for emacs-orgmode@gnu.org; Wed, 02 Jun 2021 12:21:02 -0400 Received: from ciao.gmane.io ([116.202.254.214]:43118) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loTc4-0007my-Q8 for emacs-orgmode@gnu.org; Wed, 02 Jun 2021 12:21:02 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1loTc1-0009VQ-Kn for emacs-orgmode@gnu.org; Wed, 02 Jun 2021 18:20:57 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Maxim Nikulin Subject: Re: bug#12972: 24.3.50; Move `org-open-file' and associated code out of Org mode Date: Wed, 2 Jun 2021 23:20:50 +0700 Message-ID: References: <87r1hmdqek.fsf__16088.3597027109$1622530682$gmane$org@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 In-Reply-To: <87r1hmdqek.fsf__16088.3597027109$1622530682$gmane$org@gnus.org> Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.613, 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-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lars Ingebrigtsen , 12972@debbugs.gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622650899; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ya6aiAJD1Igr7jXa0vozrMZXAQMuRezgtp9or/ZTaHk=; b=h8bCQ/rv3/7hdTlGOPcAvaX/aULQfKJfyPKUfKPOqnTDDolO0umii+91XMlKsnEFShA17f FB0oyuNlc+KXJuBNXP1Uf5oVsd4PVFo35go4k8JOAJxluFEhZn/NMom1+BFVE8uFbGXmYf W3rAtoAeviQWaX0ZgzrKtunjU1saT8tGmvzujuxT2toTM7WbXDyJ0Lsz8uGuJg3L51NVA5 gsTf49biPgvXnjRBSeZ39iCi22oX9FHQzr0rUmibSMJRPorwOfdeY5iDnsl3e2K5RIJu2R d5Bn6VQd/zYN/9ZHHbSdALHcIyHbmm69B/f7M4cYwTOniRUVYPqh25+P0b4Zsg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622650899; a=rsa-sha256; cv=none; b=tJ4wb9IUjbODBkRXs7lnX/w/UUtmxGslpbk2YyqaiA2N1/3XojWwzMnM7vdZctqq7LwKPW Lf9cpIwtJhXVAgQwz18ns0pyCeGgxEEHTfrAWceaCe3KU+xncX2Ylh2vPaoYxXxHRu47PV grBWabgAZI3BZVujQ8XdJW9urCq1XO69pldkg85+tSdspUzmKfXvH1w4l1JB0aOnw2UCPs HP9cU0ERgUeK9doirjkPTg2mflK1GTlT9uJ/GCt2F1MVXHJ6sPr6KqhmpxAha7Mdqt1omY UHKqbvURaqUhcaRXJG24WfoTto6xv4KSlT8wof7DDqpY10VpuYqsq6torRhXHg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.83 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 6DD35A9EC X-Spam-Score: -1.83 X-Migadu-Scanner: scn1.migadu.com X-TUID: ds7IsNBSJNX7 On 01/06/2021 13:56, Lars Ingebrigtsen wrote: > So I've now added this to Emacs 28 under the name > `mailcap-view-file'. I am sorry if it is a false alarm. Feel free to close the bug again if something changed recently in `start-process-shell-command' or if you prefer to discuss the issue as another bug. It seems that implementation of `mailcap-view-file' is unreliable due to creation of unnecessary terminal session and it can cause obscure and difficult to reproduce failures similar to https://lists.gnu.org/archive/html/emacs-orgmode/2020-09/msg00195.html https://lists.gnu.org/archive/html/emacs-orgmode/2020-06/msg00332.html The thread is actually longer than it is shown in the archive interface. Another lengthy discussion: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44824 In Org latest change was required for compatibility reason: https://code.orgmode.org/bzg/org-mode/commit/869b7a21b94ed112f6640c8f2711c2a68b661dea Let-bind (process-connection-type nil) is a minimal required change to avoid unnecessary terminal session. However it is not friendly to users in the case when troubleshooting is required. `make-process' with sentinel is hopefully better. The following could be ignored since it likely requires significant amount of work with unclear benefits. 1. `org-open-file' besides Org-specific stuff allows to specify precise target inside the file. It can be quite useful, e.g. okular --page 11 --find "some pattern" file.pdf PDF files have internal anchors as well. I have no consistent vision how to express additional "locators" in general API. 2. There are at least two sources of truth for MIME-handlers on linux desktop that are not necessary synchronized. Info from extracted from .desktop files may be configurable from desktop UI unlike mailcap. Distros may have some instruments to mitigate discrepancies. Debian adds entries from .desktop handlers to system-wide mailcap DB. Another approach is to add to maicap greedy xdg-open handler that tries to guess currently running desktop and pass arguments to appropriate command. Maybe mailcap should be secondary MIME database in Emacs, not the primary one. 3. Currently only file suffix is inspected to determine MIME type of a file. libmagic (or file command) usually provides more precise info, so it is possible to open an incorrectly named file. 4. Mailcap has more features that are not addressed in Emacs. They may be handy if Emacs is launched in terminal on remote server. It might allow e.g. to open PDF file using pdftotext handler. - A buffer for command output should be created for "copiousoutput" option. - A buffer should be created and terminal session should be enabled if an entry "needsterminal". - There are more substitutions than "%s". However I am unsure if it is possible to provide more info than application can obtain from the file. I think, it is intended for mail multipart messages and additional headers. On the other hand mailcap handlers might expect safe file names (minimal ASCII subset), users may have files with arbitrary names (national charset or some special characters). I hope, almost all handlers do not have such problem. In summary, during launch of external command terminal session must be suppressed. There is enough room for MIME-related improvements in Emacs in general and in Org mode in particular.