arthur miller <arthur.mil...@live.com> writes: >>> For example turn displaying pretty text (bold, italics etc), pretty links, >>> tables, dates, and perhaps some other stuff into, from Org-mode, >>> independent, >>> minor modes that could be used in other parts of Emacs and more >>> independently >>> of >>> Org mode. I think both Org-mode and Hyperbole, and perhaps some other >>> libraries >>> (button.el, help-mode, info), could use some minor mode that works with >>> links. For us users, it would mean less cruft loaded into Emacs, if those >>> big >>> players could share some code. >>> >>> I haven't done much research on this, just something I had in my head for a >>> long >>> time. >> >>I would like to hear in more details what you have in mind. As is, your >>proposal appears to be for multiple projects. Or am I mistaken? >> >>For links in particular, Hyperbole already implements the described >>minor mode, or what am I missing? >> >>For tables, dates, and other markup, it is not clear what you want to >>achieve. > > To be honest I am not sure myself :) > >> Do you want Org markup to be displayed in non-Org buffers? > > Well, part of it. Or more to make some parts of org-markup configurable, and > usable as minor modes so they can be easier used outside of org-mode. > > For example about links, there could be a mode "text-link-mode" or > "pretty-links-mode" or something, that understands what a link description is, > and what a link itself is. The minor mode would have some mean to parse > description and link parts, and when on it would do what > org-toggle-link-display > does. For example org uses angle brackets for link desc and url, whereas > markdown uses angle brackets and parenthesis. Thus link-mode could/should be > enough customizable so that modes could be clients of this minor mode, as well > as for user to be able to setup a regex or set a function that recognizes some > custom syntax for descriptions and links. Also a minor mode can come with a > key > map and some actions, for example to follow link, to insert a link etc. I > think > of org-links, but a bit more generalized and usable without org-mode > itself. Org-mode could use those under the hood.
I think this is very much related to a similar problem that bug-reference-mode tries to solve. Certain patterns can mean certain things, does something match the pattern -> buttonize. Most modes roll their own thing of such a system e.g. Circe, Gnus, Bug-reference-mode. If there was a generalized system it could make it easier to configure. The caveat is that some modes could have trouble using a generalized solution for this either because of their own historic structure (e.g. Gnus) or because it does not work for a specific modes structure e.g. when the link contains mode specific syntax. E.g. Org-Links with ID properties would not work unless properties are understood by other modes, much is woven into the org structure. I think the best solution would be to add generalized helper functions that modes can use but not to try to intercept the modes inner workings by adding a custom mode on top. However in instances where there is no special markup such a minor-mode could work and would be very helpful to support instances where there's a syntax in a syntax such as in programming comment lines. Sooner or later this will get us to having another Outline or Outshine mode.