From 663bc5ded8eaf397040684440ba51e8b61535a1f Mon Sep 17 00:00:00 2001 From: Brian Leung Date: Sun, 1 Sep 2019 19:46:27 +0200 Subject: [PATCH] gnu: Add emacs-ts. * gnu/packages/emacs-xyz.scm (emacs-ts): New variable. Signed-off-by: Oleg Pykhalov --- gnu/packages/emacs-xyz.scm | 63 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm index 0c6077770b..f810d2ad8e 100644 --- a/gnu/packages/emacs-xyz.scm +++ b/gnu/packages/emacs-xyz.scm @@ -11113,6 +11113,69 @@ (define-public emacs-org-make-toc tables of contents.") (license license:gpl3+))) +(define-public emacs-ts + (let ((commit "93c074f2895a204e003e8c7f3033c37d6486fac8") + (revision "1")) + (package + (name "emacs-ts") + (version (git-version "0.1" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/alphapapa/ts.el") + (commit commit))) + (sha256 + (base32 + "0lpyv78k04vbp9glnv14dawcfgi3m49847wlgwfmkdq5cr3fn735")) + (file-name (git-file-name name version)))) + (build-system emacs-build-system) + (propagated-inputs + `(("emacs-s" ,emacs-s) + ("emacs-dash" ,emacs-dash))) + (arguments + ;; XXX: Three tests are failing because of a timezone-related issue + ;; with how they're written. On my machine, all the failing test + ;; results are 18000 seconds (5 hours) off. + + ;; The ts-parse-org function accepts a string without any timezone + ;; info, not assumed to be in Unix time, and converts it to a so-called + ;; ts struct. The ts-unix function (accessor) accepts a ts struct, + ;; then seems to assume the struct's corresponding time is in terms of + ;; the user's current time zone, before returning a Unix time in + ;; seconds. + + ;; The failing tests all have similar problems, but nothing else about + ;; the library seems particularly off. + + `(#:tests? #t + #:test-command '("emacs" "--batch" + "-l" "test/test.el" + "-f" "ert-run-tests-batch-and-exit") + #:phases + (modify-phases %standard-phases + (add-before 'check 'make-tests-writable + (lambda _ + (make-file-writable "test/test.el") + #t)) + (add-before 'check 'delete-failing-tests + (lambda _ + (emacs-batch-edit-file "test/test.el" + `(progn (progn + (goto-char (point-min)) + (dolist (test-regexp '("ert-deftest ts-format" + "ert-deftest ts-parse-org\\_>" + "ert-deftest ts-parse-org-element")) + (re-search-forward test-regexp) + (beginning-of-line) + (kill-sexp))) + (basic-save-buffer))) + #t))))) + (home-page "https://github.com/alphapapa/ts.el") + (synopsis "Timestamp and date/time library") + (description "This package facilitates manipulating dates, times, and +timestamps by providing a @code{ts} struct.") + (license license:gpl3+)))) + (define-public emacs-org-ql (package (name "emacs-org-ql")