Subject: [bug#55674] [PATCH] gnu: emacs-helpful: Update to 0.19

From: [email-masked]
Date: Mon, 30 May 2022 09:20:24 +0200 (CEST)

Includes fixe for test from Erik Šabič against upstream,
see details in the patch file.

* gnu/packages/patches/emacs-helpful-fix-0.19-test.patch: New file.
* gnu/packages/emacs-xyz.scm: Update emacs-helpful to 0.19, use
the patch.
* gnu/local.mk: Update dist_patch_DATA.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/emacs-xyz.scm                    |  7 ++++--
 .../patches/emacs-helpful-fix-0.19-test.patch | 23 +++++++++++++++++++
 3 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/emacs-helpful-fix-0.19-test.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index bc82c5ba9f..71f6b7669a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1029,6 +1029,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/emacs-git-email-missing-parens.patch	\
   %D%/packages/patches/emacs-fix-scheme-indent-function.patch	\
   %D%/packages/patches/emacs-json-reformat-fix-tests.patch	\
+  %D%/packages/patches/emacs-helpful-fix-0.19-test.patch	\
   %D%/packages/patches/emacs-highlight-stages-add-gexp.patch	\
   %D%/packages/patches/emacs-hyperbole-toggle-messaging.patch	\
   %D%/packages/patches/emacs-libgit-use-system-libgit2.patch    \
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 31822dc641..c5fa725bf5 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -20131,7 +20131,7 @@ (define-public emacs-download-region
 (define-public emacs-helpful
   (package
     (name "emacs-helpful")
-    (version "0.18")
+    (version "0.19")
     (source
      (origin
        (method git-fetch)
@@ -20140,7 +20140,10 @@ (define-public emacs-helpful
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0gdjxykqkal2x765mi51m99i5ql23i1fy909wy4mzj5ajhjfgqcc"))))
+        (base32 "0qwsifzsjw95l83m7z07fr9h1sqbhggwmcps1qgbddpan2a8ab8a"))
+       ;; TODO: remove this patch as soon as the package is updated to 0.20
+       ;; See explanation in the patch file
+       (patches (search-patches "emacs-helpful-fix-0.19-test.patch"))))
     (build-system emacs-build-system)
     (propagated-inputs
      (list emacs-elisp-refs emacs-dash emacs-s emacs-f emacs-shut-up))
diff --git a/gnu/packages/patches/emacs-helpful-fix-0.19-test.patch b/gnu/packages/patches/emacs-helpful-fix-0.19-test.patch
new file mode 100644
index 0000000000..64000f2b73
--- /dev/null
+++ b/gnu/packages/patches/emacs-helpful-fix-0.19-test.patch
@@ -0,0 +1,23 @@
+Erik Šabič sent a pull request (patches 741b864 and 209971b) against 2f91e79,
+which is not a release.
+This is a diff between 0.19 and those 2 patches applied against 0.19.
+
+So, when 0.20 will be released, this patch can be removed.
+
+The procedure should be as simple as reverting the commit including
+this file then calling `guix refresh emacs-helpful`.
+diff --git a/test/helpful-unit-test.el b/test/helpful-unit-test.el
+index a07aa8e..8a95129 100644
+--- a/test/helpful-unit-test.el
++++ b/test/helpful-unit-test.el
+@@ -119,7 +119,9 @@ bar")))
+   (should
+    (equal
+     (helpful--docstring #'test-foo-advised t)
+-    "Docstring here too.")))
++    (if (version< emacs-version "28")
++        "Docstring here too."
++    "Docstring here too.\n\nThis function has :around advice: `ad-Advice-test-foo-advised'."))))
+ 
+ (defun test-foo-no-docstring ()
+   nil)
-- 
2.36.0