Skip to content

Consider adhering to the XDG Base Directory specification #195

@ccjmne

Description

@ccjmne

Calc is a stunningly competent tool, its documentation and the ease of browsing of its code base are astonishing, the way it integrates most completely with the rest of one's terminal habits and tools is an utter delight, and your consistently impeccable follow-throughs and curation efforts throughout the issues here are outright splendid.
Thank you very much for all of this!

Is your feature request related to a problem? Please describe.

I'm a bit bothered with tools generally polluting my home directory, and the XDG (now "freedesktop.org") established a number of largely well adopted specifications to try and rally people and their tools around some agreements. One such specification contends with where files may go: the XDG Base Directory specification.

I know full well that calc employs the CALCPATH, CALCRC, and CALCHISTFILE environment variables well, but I wish it'd be just that one little bit nicer if I could have it sniff out content where the XDG suggests content may be best found.

Describe the solution you'd like

In summary, I'd like:

  • CALCPATH to additionally look into $XDG_DATA_HOME/calc,
  • CALCRC to additionally look into $XDG_CONFIG_HOME/calc/startup, and
  • CALCHISTFILE to use $XDG_STATE_HOME/calc_history.

More specifically, so as to not possibly disrupt any preexisting user set-ups, we could/should have:

  • CALCRC only look there as a "last resort", after all the other paths searched by default have been exhausted and come up empty, and
  • CALCHISTFILE only default to preferring $XDG_STATE_HOME/calc_history if $XDG_STATE_HOME is defined.

I don't believe that taking any precautionary measure against attempting to read what the user may have in XDG_DATA_HOME/calc would be necessary.

I calqued XDG_CONFIG_HOME/calc/startup's name from its default search path component for system-wide configuration, /usr/share/calc/startup, but have no strong opinion on the naming there—except the considerable preference for a plain (read: non-hidden, non-dot-prefixed) file.

Describe alternatives you've considered

I did use CALCPATH, CALCRC, and CALCHISTFILE, as intended, to great effect already.


PS: I'm not too sure how they're generated but it seems that the copyright history is missing the years.
I had a quick look through their history and the only vaguely remarkable hint I came by was this curious replacement of 19xx by year in help/credit some time ago, in 9b6c308#diff-772e33e523d07c0ef8fb9912992a9bae5d74666a4c98caaae8b7d6b2d2ad99c5:

-Copyright (c) 19xx David I. Bell
-Copyright (c) 19xx David I. Bell and Landon Curt Noll
-Copyright (c) 19xx Landon Curt Noll
-Copyright (c) 19xx Ernest Bowen and Landon Curt Noll
+Copyright (c) year David I. Bell
+Copyright (c) year David I. Bell and Landon Curt Noll
+Copyright (c) year Landon Curt Noll
+Copyright (c) year Ernest Bowen and Landon Curt Noll

For reference, here are the "copyright history" entries I am talking about:

calc/COPYING

Lines 114 to 125 in 86a14ec

Copyright (C) year David I. Bell
Copyright (C) year David I. Bell and Landon Curt Noll
Copyright (C) year David I. Bell and Ernest Bowen
Copyright (C) year David I. Bell, Landon Curt Noll and Ernest Bowen
Copyright (C) year Landon Curt Noll
Copyright (C) year Ernest Bowen and Landon Curt Noll
Copyright (C) year Ernest Bowen
Copyright (C) year Petteri Kettunen and Landon Curt Noll
Copyright (C) year Christoph Zurnieden
Copyright (C) year Landon Curt Noll and Thomas Jones-Low
Copyright (C) year Klaus Alexander Seistrup and Landon Curt Noll
Copyright (C) year Viktor Bergquist

calc/calc.man

Lines 1337 to 1347 in 86a14ec

Copyright (C) year David I. Bell
Copyright (C) year David I. Bell and Landon Curt Noll
Copyright (C) year David I. Bell and Ernest Bowen
Copyright (C) year David I. Bell, Landon Curt Noll and Ernest Bowen
Copyright (C) year Landon Curt Noll
Copyright (C) year Ernest Bowen and Landon Curt Noll
Copyright (C) year Ernest Bowen
Copyright (C) year Petteri Kettunen and Landon Curt Noll
Copyright (C) year Christoph Zurnieden
Copyright (C) year Landon Curt Noll and Thomas Jones-Low
Copyright (C) year Klaus Alexander Seistrup and Landon Curt Noll

calc/help/credit

Lines 29 to 39 in 86a14ec

Copyright (C) year David I. Bell
Copyright (C) year David I. Bell and Landon Curt Noll
Copyright (C) year David I. Bell and Ernest Bowen
Copyright (C) year David I. Bell, Landon Curt Noll and Ernest Bowen
Copyright (C) year Landon Curt Noll
Copyright (C) year Ernest Bowen and Landon Curt Noll
Copyright (C) year Ernest Bowen
Copyright (C) year Petteri Kettunen and Landon Curt Noll
Copyright (C) year Christoph Zurnieden
Copyright (C) year Landon Curt Noll and Thomas Jones-Low
Copyright (C) year Klaus Alexander Seistrup and Landon Curt Noll

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions