larsmagne / eplot

Emacs library for creating charts
https://lars.ingebrigtsen.no/2024/06/26/a-new-package-for-making-charts-in-emacs-eplot/
99 stars 3 forks source link

Transient for configuration #3

Open dangom opened 5 days ago

dangom commented 5 days ago

Currently, configuring the plot requires adding a header to the file, which is not ideal if one already has code set to parse that file elsewhere, and requires knowledge of how to actually configure the file. Would be awesome if the configuration could come up with a transient menu instead.

Not suggesting you take it upon yourself to implement this, but figured I'd share the thought here.

Thank you for sharing!

larsmagne commented 4 days ago

Yeah, adding a non-file configuration method (via transient, as you suggest) might be nice. But in my experience, you really want to iterate on these things to get the look you're after, so going through a menu system repeatedly quickly gets boring.

But you can use the Data-File header to just include the data file, of course, but that's not really ideal either (if you have the data in a portion of a buffer).

I want to add an M-x eplot-region command that plots the data in the region (for when you have a different file mode with some data in the middle), and that makes it even more awkward to have the headers in the buffer itself.

Hm... One could have an auxiliary buffer with the headers... or as you say, use Transient somehow. Hm, yeah, I think you're right -- that would be handy, even if I don't quite see how not to make it repetetive.

Luis-Henriquez-Perez commented 4 days ago

I just wanted to add that I am skeptical of transient just because transient is just one of many packages that display different options. For example, there is ivy-hydra, there is hercules, and to some extent even embark. My point is transient is by no means the de-facto standard and I wouldn't want this package to be tied to this particular package. As I see it, a convenient binding interface is out of scope of the main purpose of the package and should be relegated to a more opinionated external package (for instance theres avy and casual-avy).

larsmagne commented 4 days ago

After thinking about this more, I think it would perhaps make more sense to allow the headers to be in an external file/buffer. That is, a command like `M-x eplot-region' that prompts for a file to get the headers from -- it's a common case to have many different data sets that you want to plot with the same headers, anyway, so headers should be externable.

I just don't see how to make a convenient interface using Transient here (or any of the other libraries that do similar many-option-things). But I could well be wrong! If anybody has ideas here, I'm all ears.

dangom commented 4 days ago

Right. Still thinking about transient (or whichever other UI) just because it can be kind of tied to config files as well (think magit, which is kind of tied to the folder at hand and .git directory), so a user could use a better interface to modify plot settings, but then manually edit them or save them outside of the UI as well.

Also, this package really made me think about Emacs as an interface to plots. I don't think there is any tool out there that allows configuring plots with keybindings. Imagine increasing the text font with a call to text-scale-increase, for example? And navigate plot elements with forward-line and backward-line? And if a package keeps track of that, it could automatically output code that users could share with non-emacsen. Possibilities would be endless. Again, thanks for sharing this - great idea, awesome proof of concept, and a lot of food for thought!

larsmagne commented 3 days ago

I've now made a minimal proof of concept thing using Transient, and I kinda like it? Invoke it via `M-x eplot-customize' in a plt buffer. (It'll move somewhere else when I'm done with fixing it up.)

mgsb commented 2 days ago

I like this transient interface - quick, easy exploration of customizations. Would be nice to have a method to extract the changes for saving to a data or header file/buffer for re-use. Thanks for the new package! It fits well with how I like to work with data.

larsmagne commented 2 days ago

Yeah, I was thinking I could use a multisession variable for the settings... but on the other hand, that would make it less easy to have separate parameters in separate buffers. So perhaps an explicit command to save/load parameters is needed. Hm. Not sure what's best.