From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: attachment: link type export to HTML invalid attach dir Date: Mon, 20 Jan 2020 02:25:21 +0100 Message-ID: <87muairkam.fsf@nicolasgoaziou.fr> References: <87pnfnee7e.fsf@gmail.com> <87o8v6iq7n.fsf@gmail.com> <87tv4xl0z9.fsf@gmail.com> <87blr3v8tm.fsf@nicolasgoaziou.fr> <87eevyud9u.fsf@nicolasgoaziou.fr> <87pnfhrob4.fsf@nicolasgoaziou.fr> <871rrvrw0b.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:42012) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itLop-0001eA-K2 for emacs-orgmode@gnu.org; Sun, 19 Jan 2020 20:25:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1itLon-0001MN-M6 for emacs-orgmode@gnu.org; Sun, 19 Jan 2020 20:25:31 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:46247) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1itLon-0001LG-Cu for emacs-orgmode@gnu.org; Sun, 19 Jan 2020 20:25:29 -0500 In-Reply-To: ("Gustav =?utf-8?Q?Wikstr=C3=B6m=22's?= message of "Sun, 19 Jan 2020 23:29:48 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: Gustav =?utf-8?Q?Wikstr=C3=B6m?= Cc: "emacs-orgmode@gnu.org" Gustav Wikstr=C3=B6m writes: > Ok, noted. To my defense I was thinking more in the terms of subtyping > then hardcoding. Because we have multiple link types which try to > share an interface. But the interface isn't perfect for all different > kinds of links. Then, I suggest to improve the interface. > So it doesn't seem too farfetched that some of those link types would > benefit from additional custom properties, specific for those types. > =3Dapplication=3D and =3Dsearch-option=3D for example isn't universally > applicable to all link types. As a side note, :application is on its way out, i.e., "file+emacs" stuff is in "org-compat.el". Also, IIRC, "docview" links have "go to page" option, and they don't touch the parser. > What I'm trying to argue for here is: Maybe it's not that crazy after > all to allow links to have additional properties in the parser based > on its type? (While certainly still trying to avoid it if possible!) If new link types may not function correctly without touching the parser, how do you create new link types out of Org's core? This is not modular at all. > (Off topic) I'm sorry to hear that you think I'm intentionally making > things fuzzy. Not at all! My wording is terrible. When I wrote Also, you sometimes seem to blur, on purpose, the difference between "attachment" and "file" links. I meant something like: It seems to me that your intent is to have "attachment" links transparently become "file" links to the user. Hence my suggestion to use link abbreviations. There's nothing negative in it. > One can indeed use the buffer position to derive the part of the path > that comes from the subtree. But leaving it at that puts more > requirements on the user of the parsed link in order to use it. And higher order functions in "org-attach" could take care of it. Note that expanding a link in the parser means all attachment links are always expanded, even if they are not used. There's a cost to consider. Besides, parser focus on the contents of the buffer. I think it is out of its scope to infer file names for abbreviation links. It's more the job of the parts consuming the parsed data. > There is no :raw-path available in the properties for a parsed link. > If there were we surely wouldn't have this conversation and I'd be > using that already! :)=20 I meant :raw-link, sorry. > I.e. I like this suggestion. I considered using the :raw-link > property, but the way it's currently used by the parser (i.e. > expanding abbreviations) stopped me. Please take how link abbreviations are handled in the parser out of the equation. I already stated this is not a good way to handle them. We should probably expand them in a "temp-link" variable, and parse it, while keeping original link in :raw-link (barring white spaces fixes). That would not be perfect either, because we would still be inferring stuff. That's another topic, really. Let's just ignore it for now. > So, we're discussing regarding attachment as either: an abbreviation > or a proper separate link type? I'm not sure what other options we > have? I personally can't categorize it as an abbreviation since that > is handled by a separate piece of code with other specifications. I.e. > attachment wouldn't fit well inside org-link-abbrev-alist.=20 What makes you think it wouldn't fit well? > Attachments should function in the same way as file links, with search > options and all. But be limited to the current set of attached files. This isn't incompatible with the above, AFAICT. > That's basically the way it was before the patches to fix stardiviners > issues. Except not functioning well enough. It would require quite > some code in org-attach to replicate existing file links > functionality. Mostly code duplication I presume. I didn't read stardiviner issues. Would you mind summarizing them? Or, at least could you explain what is not functioning well enough? Anyhow, you may have missed the "let's spot the needs and improve these tools" part. If current tools lead to code duplication, we can fix that. > The raw-path option sounds better to my ears. Except I was meaning :raw-link :) > One improvement I can think of (outside of the discussion above) is to > make it possible to pass the argument to org-link-open along to each > separate link type specialization. Isn't that the job of :follow when defining a new link type? > That one has bugged me for some time now, when I've wanted to force > opening attachment links in emacs but couldn't. IMO, forcing users to open stuff in a specific, non-configurable, way is a bad idea. Why would we know better than them?