~ruther/guix-local

3f2b729589320ee60561ad94284a19e824b2dc52 — Cayetano Santos 2 months ago 7e90b2f
gnu: Add emacs-difftastic.

* gnu/packages/emacs-xyz.scm (emacs-difftastic): New variable.

Closes guix/guix#4856

Change-Id: Iee6ca9e3c43a989dcda2c84a31d18c9328b07b96
1 files changed, 85 insertions(+), 0 deletions(-)

M gnu/packages/emacs-xyz.scm
M gnu/packages/emacs-xyz.scm => gnu/packages/emacs-xyz.scm +85 -0
@@ 22780,6 22780,91 @@ window (using the fringe, by default), allows you to jump between the hunks
and revert them selectively.")
    (license license:gpl3+)))

(define-public emacs-difftastic
  ;; No releases or tags.
  (let ((commit "5a23176610b7181f52b7088cbdf1d2a95691b27e")
        (revision "0"))
    (package
      (name "emacs-difftastic")
      (version (git-version "0.0.0" revision commit))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
                (url "https://github.com/pkryger/difftastic.el/")
                (commit commit)))
         (file-name (git-file-name name version))
         (sha256
          (base32
           "0nl1kcaxgq67338knfhmxxmxl5npsvjvvs3z7s8m5z4wpknsn1rd"))))
      (build-system emacs-build-system)
      (arguments
       (list
        #:test-command
        #~(list "emacs" "--batch"
                "-l" "test/difftastic.t.el"
                "-l" "test/difftastic-bindings.t.el"
                "-f" "ert-run-tests-batch-and-exit")
        #:phases
        #~(modify-phases %standard-phases
            (add-before 'check 'unpack-el-mock
              (lambda _
                (install-file
                 (string-append
                  #$(this-package-native-input "el-mock") "/el-mock.el")
                 ".")))
            ;; 11/435 tests fail.
            (add-before 'check 'skip-failing-tests
              (lambda _
                (let ((skip-tests
                       `("-forge-pullreq-show-diff-args:buffer-post-object"
                         "-forge-pullreq-show-diff-args:current-topic"
                         ,(string-append
                           "-forge-pullreq-show-diff-args"
                           ":new-pullreq-with-base-and-head")
                         "-forge-pullreq-show-diff-args:single-prefix-argument"
                         "-magit-diff-buffer-file:no-file"
                         "-forge-pullreq-show-diff-args:triple-prefix-argument"
                         "forge-create-pulreq-show-diff:basic"
                         "forge-pullreq-show-diff:basic"
                         "forge-pullreq-show-diff:double-prefix-arg"
                         "forge-pullreq-show-diff:single-prefix-arg"
                         "forge-pullreq-show-diff:triple-prefix-arg")))
                  (substitute* "test/difftastic.t.el"
                    (("\\(ert-deftest difftastic-([a-z:-]*) \\(\\)" all test)
                     (if (member test skip-tests)
                         (string-append all "(skip-unless nil)")
                         all))))))
            (add-after 'unpack 'substitute-python-path
              (lambda* (#:key inputs #:allow-other-keys)
                (emacs-substitute-variables "difftastic.el"
                  ("difftastic-executable"
                   (search-input-file inputs "/bin/difft"))))))))
      (inputs
       (list difftastic))
      (propagated-inputs
       (list emacs-compat emacs-magit))
      (native-inputs
       (list
        ;; This package uses a custom version of el-mock for the tests.
        (origin
          (method git-fetch)
          (uri (git-reference
                 (url "https://github.com/pkryger/el-mock.el")
                 (commit "8fb750784faf07445033441bd86485fecfdb9413")))
          (file-name "el-mock")
          (sha256
           (base32
            "1qbcj952hrrpr26rh8q77vf5i35nzkbsrqdvj7rrc307dp0n2gsv")))))
      (home-page "https://github.com/pkryger/difftastic.el/")
      (synopsis "Wrapper interface for @code{difft} command line tool")
      (description
       "This package integrates @code{difftastic} structural diff tool into
Emacs.  It automatically displays @code{difftastic} output within Emacs using
faces from the user theme, ensuring consistency with overall coding
environment.")
      (license license:gpl3+))))

(define-public emacs-diminish
  ;; XXX: Upstream did not tag last release.
  (let ((commit "fd486ef76e4c1d8211ae337a43b8bba106d4bca7")