summary refs log tree commit diff
diff options
context:
space:
mode:
authorLiliana Marie Prikler <liliana.prikler@gmail.com>2022-05-15 03:05:28 +0200
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2022-05-15 03:07:50 +0200
commit22d6e36005322cd641bc1107f3f04945e03478d5 (patch)
tree491b48d41e59ff41f2e5354ef9523a25ef664f38
parentde68877a517ba058f67086d444d7265c9c803679 (diff)
downloadguix-22d6e36005322cd641bc1107f3f04945e03478d5.tar.gz
gnu: emacs-yasnippet: Fix build.
* gnu/packages/patches/emacs-yasnippet-fix-tests.patch: New file.
* gnu/packages/emacs-xyz.scm (emacs-yasnippet): Use it here.
* gnu/local.mk (dist_patch_DATA): Register it here.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/emacs-xyz.scm4
-rw-r--r--gnu/packages/patches/emacs-yasnippet-fix-tests.patch95
3 files changed, 99 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index d5b60bdba3..cfb499915a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1038,6 +1038,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/emacs-telega-path-placeholder.patch	\
   %D%/packages/patches/emacs-telega-test-env.patch		\
   %D%/packages/patches/emacs-wordnut-require-adaptive-wrap.patch	\
+  %D%/packages/patches/emacs-yasnippet-fix-tests.patch	\
   %D%/packages/patches/enjarify-setup-py.patch			\
   %D%/packages/patches/enlightenment-fix-setuid-path.patch	\
   %D%/packages/patches/eog-update-libportal-usage.patch		\
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 787f6fc43e..8a319fc0ff 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -13490,7 +13490,9 @@ the Emacs Tempo library.  You may also write your templates in Lisp.")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0via9dzw8m5lzymg1h78xkwjssh39zr3g6ccyamlf1rjzjsyxknv"))))
+        (base32 "0via9dzw8m5lzymg1h78xkwjssh39zr3g6ccyamlf1rjzjsyxknv"))
+       (patches
+        (search-patches "emacs-yasnippet-fix-tests.patch"))))
     (build-system emacs-build-system)
     (arguments
      `(#:tests? #t
diff --git a/gnu/packages/patches/emacs-yasnippet-fix-tests.patch b/gnu/packages/patches/emacs-yasnippet-fix-tests.patch
new file mode 100644
index 0000000000..475352d8db
--- /dev/null
+++ b/gnu/packages/patches/emacs-yasnippet-fix-tests.patch
@@ -0,0 +1,95 @@
+From 904a058fcf4e1f4985e03f8551eec282ca12ccb5 Mon Sep 17 00:00:00 2001
+From: Philipp Stephani <phst@google.com>
+Date: Mon, 6 Dec 2021 18:50:10 +0100
+Subject: [PATCH] Unbreak unit tests under Emacs 28.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+- Emacs 28 has a new mode ‘lisp-data-mode’ for Lisp data.
+- A test that was temporarily broken passes again.
+- The default for ‘org-adapt-indentation’ has changed.
+---
+ yasnippet-tests.el | 41 ++++++++++++++++++++++++++---------------
+ 1 file changed, 26 insertions(+), 15 deletions(-)
+
+diff --git a/yasnippet-tests.el b/yasnippet-tests.el
+index b8a7980f..9fadf00c 100644
+--- a/yasnippet-tests.el
++++ b/yasnippet-tests.el
+@@ -1,6 +1,6 @@
+ ;;; yasnippet-tests.el --- some yasnippet tests  -*- lexical-binding: t -*-
+ 
+-;; Copyright (C) 2012-2015, 2017-2018  Free Software Foundation, Inc.
++;; Copyright (C) 2012-2015, 2017-2018, 2021  Free Software Foundation, Inc.
+ 
+ ;; Author: João Távora <joaot@siscog.pt>
+ ;; Keywords: emulations, convenience
+@@ -556,16 +556,19 @@ XXXXX   ------------------------"))))
+     (yas-mock-insert "foo bar")
+     (ert-simulate-command '(yas-next-field))
+     (goto-char (point-min))
+-    (let ((expected (with-temp-buffer
+-                      (insert (format (concat "* Test foo bar\n"
+-                                              "  " org-property-format "\n"
+-                                              "  " org-property-format "\n"
+-                                              "  " org-property-format)
+-                                      ":PROPERTIES:" ""
+-                                      ":ID:" "foo bar-after"
+-                                      ":END:" ""))
+-                      (delete-trailing-whitespace)
+-                      (buffer-string))))
++    ;; The default value of `org-adapt-indentation' changed between Org-mode 9.4
++    ;; and 9.5, so force a specific value.
++    (let* ((org-adapt-indentation nil)
++           (expected (with-temp-buffer
++                       (insert (format (concat "* Test foo bar\n"
++                                               org-property-format "\n"
++                                               org-property-format "\n"
++                                               org-property-format)
++                                       ":PROPERTIES:" ""
++                                       ":ID:" "foo bar-after"
++                                       ":END:" ""))
++                       (delete-trailing-whitespace)
++                       (buffer-string))))
+       ;; Some org-mode versions leave trailing whitespace, some don't.
+       (delete-trailing-whitespace)
+       (should (equal expected (buffer-string))))))
+@@ -1390,7 +1393,9 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
+                           ,@(if (fboundp 'prog-mode)
+                                 '(prog-mode))
+                           emacs-lisp-mode
+-                          lisp-interaction-mode))
++                          lisp-interaction-mode
++                          ;; `lisp-data-mode' doesn't exist prior to Emacs 28.
++                          ,@(and (fboundp 'lisp-data-mode) '(lisp-data-mode))))
+               (observed (yas--modes-to-activate)))
+          (should (equal major-mode (car observed)))
+          (should (equal (sort expected #'string<) (sort observed #'string<))))))))
+@@ -1418,7 +1423,11 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
+                                      '(prog-mode))
+                                emacs-lisp-mode
+                                and-also-this-one
+-                               lisp-interaction-mode))
++                               lisp-interaction-mode
++                               ;; `lisp-data-mode' doesn't exist prior to
++                               ;; Emacs 28.
++                               ,@(and (fboundp 'lisp-data-mode)
++                                      '(lisp-data-mode))))
+               (observed (yas--modes-to-activate)))
+          (should (equal expected-first
+                         (cl-subseq observed 0 (length expected-first))))
+@@ -1691,9 +1700,11 @@ TODO: be meaner"
+   "Test expansion of snippets in org source blocks."
+   ;; org 9+ no longer runs fontification for text-mode, so our hacks
+   ;; don't work.  Note that old ert doesn't have skipping, so we have
+-  ;; to expect failure instead.
++  ;; to expect failure instead.  Starting with Org-mode 9.5 this seems
++  ;; to work again.
+   :expected-result (if (and (fboundp 'org-in-src-block-p)
+-                            (version< (org-version) "9"))
++                            (or (version< (org-version) "9")
++                                (version<= "9.5" (org-version))))
+                        :passed :failed)
+   (let ((text-mode-hook #'yas-minor-mode))
+     (do-yas-org-native-tab-in-source-block "text")))