From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.devel Subject: Re: master 85e1719 1/4: Add a new command `mailcap-view-file' Date: Tue, 01 Jun 2021 20:37:36 +0100 Message-ID: <8735u1jrzz.fsf@tcd.ie> References: <20210601082439.8239.91284@vcs0.savannah.gnu.org> <20210601082441.0348220DFE@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31856"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Lars Ingebrigtsen To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 01 21:55:20 2021 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 1loATw-00089O-CE for ged-emacs-devel@m.gmane-mx.org; Tue, 01 Jun 2021 21:55:20 +0200 Original-Received: from localhost ([::1]:47098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1loATv-0007P4-BG for ged-emacs-devel@m.gmane-mx.org; Tue, 01 Jun 2021 15:55:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loACv-0005A5-JZ for emacs-devel@gnu.org; Tue, 01 Jun 2021 15:37:45 -0400 Original-Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:40737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1loACt-0003g7-Ff for emacs-devel@gnu.org; Tue, 01 Jun 2021 15:37:45 -0400 Original-Received: by mail-wr1-x42c.google.com with SMTP id z17so15550372wrq.7 for ; Tue, 01 Jun 2021 12:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=OOHwI/6wgwKZuoemrv0n/YGUUYjZbhqso0FQAVP07mM=; b=eU+6sNn59CGf7+7sXv77Yqy/tWO2HJCQnUbN2+8dcb+W3krxansPLFXVzuxScb2wgM W4yh4+b1Xdey2VMRLRaAo4VLPRqHBXUY4JHmA/EQOaUUTj7l7KRwbb9apsmxsCF/7XPi s1HVOrBfbxP/9Isqa2qcpWebNaDpryaMVuDnWhcwpBA3uePSI30hZdfRdXxqR7ALJhJV 2i4AS0b3HtS23xmEhgDtxsXLqqDsgCZGJ3T6O8SywCko9RD+gIWbT88Q/0W7uvapL9ix upKa40dK4k0lXq9er8+1MMuTNuQ6kosnb7x8VpfZX7/CJQJzHpH7ZtKeZKBrrVFE2rFq JDsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=OOHwI/6wgwKZuoemrv0n/YGUUYjZbhqso0FQAVP07mM=; b=JhhT8HohiEjY7XrBPCcfEeWAshAFQDA34NGq0XJpg4bbuG51HzeJbo5tYBu9y3p9Gj XpHE2/NisZbwktLcoaYzaaa6ddFY3ZeLLEJ/KRebPtb2oqXL4yapISg5voFKZ5a20Va1 3Xdp4pK4SqSxS9IjUszQClvYTUosat9hyaLB3n9eVgq/8ORnU6ERIGUq7REG0d+gLDlq UWsJavmvBEsSu1N8og90VcwDMc8WKpBOl6melbaHPY8rQREbSW7UP2drO5SlzpSCbHYi WyQU/S2JiFDgonyeQGcMzylQzWr0R4HraxchbKIe6sU/oa8x9xiSgpaOXyHieIbc3gNZ 0ymg== X-Gm-Message-State: AOAM533b1idJoWIg/Ge3Gl/vO6S4Uhtk2VfG89gU6Ye0fVavcKqTQdxq zrWNzXk9QtdqlroEqVz6XcXjZrr7hUMPkA== X-Google-Smtp-Source: ABdhPJxgNMzRmmg8azmauFRi5vbIEb3MoClr+xZm90d2qFBVNgpRf7N8qEoPDUAKCbffUn5LLGwYiQ== X-Received: by 2002:a5d:6382:: with SMTP id p2mr12481002wru.338.1622576258427; Tue, 01 Jun 2021 12:37:38 -0700 (PDT) Original-Received: from localhost ([51.37.43.71]) by smtp.gmail.com with ESMTPSA id c15sm4165745wrd.49.2021.06.01.12.37.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 12:37:37 -0700 (PDT) In-Reply-To: <20210601082441.0348220DFE@vcs0.savannah.gnu.org> (Lars Ingebrigtsen's message of "Tue, 1 Jun 2021 04:24:40 -0400 (EDT)") Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=contovob@tcd.ie; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:270247 Archived-At: larsi@gnus.org (Lars Ingebrigtsen) writes: > branch: master > commit 85e17196fa2b6333fbce7fdac1e2e17b045b91ae > Author: Lars Ingebrigtsen > Commit: Lars Ingebrigtsen > > Add a new command `mailcap-view-file' [...] > +(defun mailcap-view-file (file) > + "View FILE according to rules given by the mailcap system. > +This normally involves executing some external program to display > +the file. > + > +See \"~/.mailcap\", `mailcap-mime-data' and related files and variables." > + (interactive "fOpen file with mailcap: ") > + (setq file (expand-file-name file)) > + (mailcap-parse-mailcaps) > + (let ((command (mailcap-mime-info What if mailcap-mime-info returns a function? > + (mailcap-extension-to-mime (file-name-extension file))))) Is this the same as mailcap-file-name-to-mime-type? > + (unless command > + (error "No viewer for %s" (file-name-extension file))) > + ;; Remove quotes around the file name - we'll use shell-quote-argument. > + (while (string-match "['\"]%s['\"]" command) > + (setq command (replace-match "%s" t t command))) > + (setq command (replace-regexp-in-string > + "%s" > + (shell-quote-argument (convert-standard-filename file)) > + command > + nil t)) > + (start-process-shell-command command nil command))) Should any of this function's logic be shared with mailcap-view-mime? Thanks, -- Basil