From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.sources Subject: xdgdirs 1.0 Date: Thu, 05 Sep 2013 12:42:55 +0200 Message-ID: <87hadzczww.fsf@zigzag.favinet> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1378377656 17725 80.91.229.3 (5 Sep 2013 10:40:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Sep 2013 10:40:56 +0000 (UTC) Cc: guile-user@gnu.org To: guile-sources@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Sep 05 12:40:58 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VHWzh-0003P3-JW for guile-user@m.gmane.org; Thu, 05 Sep 2013 12:40:57 +0200 Original-Received: from localhost ([::1]:58048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHWzh-0006hl-7q for guile-user@m.gmane.org; Thu, 05 Sep 2013 06:40:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHWzI-0006fp-3N for guile-user@gnu.org; Thu, 05 Sep 2013 06:40:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHWzA-0000FT-FV for guile-user@gnu.org; Thu, 05 Sep 2013 06:40:31 -0400 Original-Received: from smtp206.alice.it ([82.57.200.102]:47166) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHWyv-0000Ah-8K; Thu, 05 Sep 2013 06:40:09 -0400 Original-Received: from zigzag.favinet (79.41.72.98) by smtp206.alice.it (8.6.060.28) id 5224A897013C8296; Thu, 5 Sep 2013 12:40:07 +0200 Original-Received: from ttn by zigzag.favinet with local (Exim 4.80) (envelope-from ) id 1VHX1x-0000Df-7g; Thu, 05 Sep 2013 12:43:17 +0200 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.102 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10753 gmane.lisp.guile.sources:423 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Greetings earthlings, I'm contemplating adding XDG basedirs support to GNU Alive and GNU Serveez, so the obvious approach is classic modularity: write the functionality once and somehow make it available. It's no big deal to start w/ =E2=80=98define-module=E2=80=99, but then the questions begin: - What is a good module name? - What package does it belong to? - Does the use case justify keeping all this code in memory? - Is this really "write once"? - What about Lisp programs? - What about programs (in any language) that can =E2=80=98read=E2=80=99 = sexps? The functionality is basically using =E2=80=98getenv=E2=80=99 and =E2=80=98= parse-path=E2=80=99 to produce easily-serialized data (strings and lists of strings), amenable to piping and other textual manipulations. So, why not a standalone program? As to the packaging, for a bit i mulled over a "XDG Utils" package with only one program to start, but that would be succumbing to my bad habit of overengineering things, so i'm glad to say that bit was short-lived. Anyway, here it is: --=-=-= Content-Type: application/x-scheme Content-Disposition: attachment; filename=xdgdirs Content-Transfer-Encoding: base64 IyEvYmluL3NoCmV4ZWMgJHtHVUlMRS1ndWlsZX0gLXMgJDAgIiRAIiA7IyAtKi1zY2hlbWUtKi0K ISMKOzs7IHhkZ2RpcnMKCihkZWZpbmUgQ09QWVJJR0hUICJDb3B5cmlnaHQgKE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o7Owo7OyAgKE5BTUUgLiBWQUxV RSkKOzsKOzsgT3B0aW9uYWwgYXJnIOKAmC0tYWxpc3TigJkgbWVhbnMgdG8gZGlzcGxheSBvbmUg c2V4cCwgb25seSwgZm9ybWVkCjs7IGJ5IOKAmGxpc3TigJlpbmcgdGhlIG5vcm1hbCBvdXRwdXQu ICBUaGUgb3V0cHV0IGlzIGFuIGFsaXN0Lgo7Owo7OyBJbiB0aGUgZm9sbG93aW5nIHRhYmxlLCBh bGwgdmFsdWVzIG1heSBhbHNvIGJlIOKAmG5h4oCZLAo7OyBhIHN5bWJvbCB0aGF0IHN0YW5kcyBm b3IgIm5vdCBhdmFpbGFibGUiLgo7Owo7OyDilILilIDilIDilIDilIDilIDilIDilIDilIDilIDi lIDilIDilIDilIDilIDilIDilIDilIDilKzilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDi lIDilIDilIDilKzilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDi lIDilIDilIIKOzsg4pSCIGVudiB2YXIgICAgICAgICDilIIgTkFNRSAgICAgICAg4pSCIFZBTFVF IHR5cGUgICAgICDilIIKOzsg4pSC4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA 4pSA4pSA4pSA4pSA4pSA4pS84pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA 4pS84pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSA4pSC Cjs7IOKUgiBYREdfREFUQV9IT01FICAg4pSCIGRhdGHilIBob21lICAg4pSCIHN0cmluZyAgICAg ICAgICDilIIKOzsg4pSCIFhER19DT05GSUdfSE9NRSDilIIgY29uZmln4pSAaG9tZSDilIIgc3Ry aW5nICAgICAgICAgIOKUggo7OyDilIIgWERHX0RBVEFfRElSUyAgIOKUgiBkYXRh4pSAZGlycyAg IOKUgiBsaXN0IG9mIHN0cmluZ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AgICAgKGZzbyAifkF+JSIgKGZpbGUtY29tbWVu dGFyeSAoY2FyIChjb21tYW5kLWxpbmUpKSkpCiAgICAgICAoZXhpdCAjdCkpKQoKKGNvbmQgKCht ZW50aW9uZWQ/ICItLXZlcnNpb24iKQogICAgICAgKGZzbyAieGRnZGlycyB+QX4lfkF+JSIgVkVS U0lPTiBDT1BZUklHSFQpCiAgICAgICAoZnNvICJ+QSB+QX4lfkF+JX5BfiUiCiAgICAgICAgICAg ICJMaWNlbnNlIEdQTHYzKzogR05VIEdQTCB2ZXJzaW9uIDMgb3IgbGF0ZXIiCiAgICAgICAgICAg ICI8aHR0cDovL2dudS5vcmcvbGljZW5zZXMvZ3BsLmh0bWw+IgogICAgICAgICAgICAiVGhpcyBp cyBmcmVlIHNvZnR3YXJlOiB5b3UgYXJlIGZyZWUgdG8gY2hhbmdlIGFuZCByZWRpc3RyaWJ1dGUg aXQuIgogICAgICAgICAgICAiVGhlcmUgaXMgTk8gV0FSUkFOVFksIHRvIHRoZSBleHRlbnQgcGVy bWl0dGVkIGJ5IGxhdy4iKQogICAgICAgKGV4aXQgI3QpKSkKCihkZWZpbmUgQUxJU1QgKGFuZCAo bWVudGlvbmVkPyAiLS1hbGlzdCIpICcoKSkpCihkZWZpbmUgREVGQVVMVFM/ICAobWVudGlvbmVk PyAiLS1kZWZhdWx0cyIpKQoKKGRlZmluZSBob21lLwogIChsZXQgKChob21lIChvciAoZ2V0ZW52 ICJIT01FIikKICAgICAgICAgICAgICAgICAgKHBhc3N3ZDpkaXIKICAgICAgICAgICAgICAgICAg IChvciAoYW5kPT4gKG9yIChnZXRlbnYgIkxPR05BTUUiKQogICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgKGdldGVudiAiVVNFUiIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBnZXRwd25hbSkKICAgICAgICAgICAgICAgICAgICAgICAoZ2V0cHd1aWQgKGdldHVpZCkpKSkp KSkKICAgIChsYW1iZGEgKGRpcikKICAgICAgKGluLXZpY2luaXR5IGhvbWUgZGlyKSkpKQoKKGRl ZmluZSAob3V0IHgpCiAgKGZzbyAiflN+JSIgeCkpCgooZGVmaW5lIHllcCAoaWYgQUxJU1QKICAg ICAgICAgICAgICAgIChsYW1iZGEgKG5hbWUgdmFsdWUpCiAgICAgICAgICAgICAgICAgIChzZXQh IEFMSVNUIChhY29ucyBuYW1lIHZhbHVlIEFMSVNUKSkpCiAgICAgICAgICAgICAgICAobGFtYmRh IChuYW1lIHZhbHVlKQogICAgICAgICAgICAgICAgICAob3V0IChjb25zIG5hbWUgdmFsdWUpKSkp KQoKKGRlZmluZSAodHJ5IGFzKQogIChsYW1iZGEgKG9uZSB0d28gZHYpCiAgICAobGV0ICgoZW52 IChzdHJpbmctdXBjYXNlIChzaW1wbGUtZm9ybWF0ICNmICJYREdffkFffkEiCiAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uZQogICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICB0d28pKSkpCiAgICAgICh5ZXAgKHN5bWJvbC1hcHBl bmQgb25lICctIHR3bykKICAgICAgICAgICAoY29uZCAoKGdldGVudiBlbnYpID0+IGFzKQogICAg ICAgICAgICAgICAgIChERUZBVUxUUz8gZHYpCiAgICAgICAgICAgICAgICAgKGVsc2UgJ25hKSkp KSkpCgooZGVmaW5lIHBhdGggKHRyeSBwYXJzZS1wYXRoKSkKKGRlZmluZSBzaW5nbGUgKHRyeSBp ZGVudGl0eSkpCgooc2luZ2xlICdkYXRhICAgICdob21lICAoaG9tZS8gIi5sb2NhbC9zaGFyZSIp KQooc2luZ2xlICdjb25maWcgICdob21lICAoaG9tZS8gIi5jb25maWciKSkKKHBhdGggICAnZGF0 YSAgICAnZGlycyAnKCIvdXNyL2xvY2FsL3NoYXJlIiAiL3Vzci9zaGFyZSIpKQoocGF0aCAgICdj b25maWcgICdkaXJzICcoIi9ldGMveGRnIikpCihzaW5nbGUgJ2NhY2hlICAgJ2hvbWUgIChob21l LyAiLmNhY2hlIikpCihzaW5nbGUgJ3J1bnRpbWUgJ2RpciAgJ25hKQoKKGFuZCBBTElTVCAob3V0 IChyZXZlcnNlISBBTElTVCkpKQoKKGV4aXQgI3QpCgo7OzsgeGRnZGlycyBlbmRzIGhlcmUK --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Installation is simple: # install xdgdirs /usr/local/bin The program supports =E2=80=98--help=E2=80=99 and =E2=80=98--version=E2=80= =99, which must suffice in lieu of proper documentation, for now. Maybe some future release... =2D-=20 Thien-Thi Nguyen GPG key: 4C807502 (if you're human and you know it) read my lisp: (responsep (questions 'technical) (not (via 'mailing-list))) =3D> nil --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlIoYDsACgkQZwMiJEyAdQJu8ACgkB4WI/vu5Y6aMQd8QnErUkJ8 e+wAoMXSJOJwqTKmfmEHcWJ8oLY0u/E0 =ZgSt -----END PGP SIGNATURE----- --==-=-=--