From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Image-conversion shims Date: Sun, 29 Sep 2019 14:56:51 +0300 Message-ID: <83eezzfh8c.fsf@gnu.org> References: <87v9tctcca.fsf@gnus.org> <87impct2xf.fsf@gnus.org> <83zhinfufb.fsf@gnu.org> <87ftkfnx7a.fsf@gnus.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="131777"; mail-complaints-to="usenet@blaine.gmane.org" Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 29 13:57:10 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iEXp8-000Y6C-Hw for ged-emacs-devel@m.gmane.org; Sun, 29 Sep 2019 13:57:10 +0200 Original-Received: from localhost ([::1]:38374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iEXp7-000522-7a for ged-emacs-devel@m.gmane.org; Sun, 29 Sep 2019 07:57:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50134) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iEXoy-00051r-AX for emacs-devel@gnu.org; Sun, 29 Sep 2019 07:57:01 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47551) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iEXox-0005ku-Uk; Sun, 29 Sep 2019 07:57:00 -0400 Original-Received: from [176.228.60.248] (port=3585 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iEXox-0006EU-6G; Sun, 29 Sep 2019 07:56:59 -0400 In-reply-to: <87ftkfnx7a.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 29 Sep 2019 13:44:41 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240389 Archived-At: > From: Lars Ingebrigtsen > Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org > Date: Sun, 29 Sep 2019 13:44:41 +0200 > > Uhm... what about... image-use-external-converter? SGTM. > > I also think that using call-process for invoking the converter makes > > the feature less flexible and more "tricky" to maintain. Already you > > needed to jump through some hoops to support "gm convert". I think > > using shell-command would have made all this much simpler and more > > straightforward. > > It's true that it's simpler, but I've been bitten by corner cases in > escape handling of file names before (and we're dealing with file names > that are under some degree of control by an attacker), so I just think > it's easier to not have to think about those issues at all (i.e., use > call-process). But that means the command strings are restricted in what they can use, because split-string has some limitations that aren't immediately evident. So if you want to leave this stuff as-is, at least we should say something in the doc string of image-converter--converters to that effect that; e.g., I think quotes should not be allowed there. > I was pondering whether something could be done in `set-auto-mode'. It > already consults a wide number of variables to determine the mode. > Could we add yet another one that's more flexible? > > That is, it would be an alist on the form (variable . action) and would > be consulted last in that function as the final fallback. Like: > > (defvar auto-mode-dependent-action-alist > '((convert-images-externally . image-image-converter-file-alist))) > > and the code would be > > (dolist (elem auto-mode-dependent-action-alist) > (when (bound-and-true-p (car elem)) > (let ((alist (cdr elem))) > ;; Do the same thing as with auto-mode-alist > )) Maybe. It sounds a bit too convoluted to me, and I hoped for a simpler solution... Actually, why not simply add the relevant extensions to auto-mode-alist, causing them to invoke image-mode?