Re: [PATCH] XDG base directory support (history and wxt)

Ethan A Merritt <[email protected]>
Newsgroups gmane.comp.graphics.gnuplot.devel
Organization University of Washington
Message-ID <116626474.YYNEc63iSX@stonelion>
I applied this patch and did a commit to the development branch.
I added a brief mention under "set history" in the documentation.

I'm not actually using XDG normally, so I could do only limited testing.

	thanks,

		Ethan

On Tuesday, 14 September 2021 02:11:58 PDT Jun T wrote:
> 
> > 2021/09/14 4:06, Ethan A Merritt <[email protected]> wrote:
> > 
> >  I realize that the previous XDG patch already put a
> > chunk of code in plot.c to hande the gnuplotrc file, but wouldn't it
> > be better to have that code and the new patch code for the history file
> > live in xdg.c instead?
> > Then in plot.c or history.c the call site would
> > be:
> > 
> > #ifdef USE_XDG_BASEDIR
> >    expanded_history_filename = some_new_xdg_routine(GNUPLOT_HISTORY_FILE));
> > #endif
> >    if (!expanded_history_filename) {
> > 	/* current code */
> > 	expanded_history_filename = tilde_expand(GNUPLOT_HISTORY_FILE);
> >    }
> >    read_history(expanded_history_filename);
> 
> How about the revised patch (xdg-v2.patch)?
> I moved "most" of the complication into a function in xdg.c, but plot.c is
> not as simple as above.
> 
> 
> >> [2] Migration
> >> With the patch, gnuplot will continue to use traditional config or history
> >> files in ~/ if they exist (as it does for the main config file ~/.gnuplot).
> >> Users must move the traditional files to XDG dirs (or remove ~/.gnuplot-wxt
> >> and ~/.gnuplot_history) manually if they want to migrate.
> > 
> > Isn't the obvious migration to set
> > 	XDG_DATA_DIRS = $HOME:$HOME/.local/share
> > 	XDG_CONFIG_HOME = $HOME:$HOME/.config
> 
> I couldn't understand this part...
> 
> > Your current home directory files will be used whether or not
> > you have XDG enabled, so moving files is not required.
> 
> > If you choose to enable XDG and move the files, that works also.
> 
> Yes, this is the case with my match.
> 
> As I wrote, with my patch, if ~/.gnuplot_history or ~/.gnuplot-wxt exists
> gnuplot will continue to use them. User need not do anything if they are
> satisfied with this traditional behavior.
> 
> If a user wants to use XDG directory, she/he must manually move
> ~/.gnuplot_history to ~/.local/state/gnuplot_history, and
> ~/.gnuplot-wxt to ~/.config/gnuplot/gnuplot-wxt.conf
> (or just remove them), but need not set XDG_CONFIG_HOME etc.
> 
> (if XDG_CONFIG_HOME is set then it is used instead of ~/.config/, of course)
> 
> Is this OK?
> 
> 


-- 
Ethan A Merritt
Biomolecular Structure Center,  K-428 Health Sciences Bldg
MS 357742,   University of Washington, Seattle 98195-7742




_______________________________________________
gnuplot-beta mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.