l...@gnu.org (Ludovic Courtès) writes:

> Mathieu Lirzin <m...@openmailbox.org> skribis:
>
>> * guix/ui.scm (texi->plain-text): Export.
>> * guix/scripts/lint.scm (check-description-style): Use it instead of
>>   'package-description-string'.
>
> [...]

After pushing it, I discovered one mistake here is the patch fixing
it...

>From 76f98cfc1567450913394ca871ebce40c8ed70e2 Mon Sep 17 00:00:00 2001
From: Mathieu Lirzin <m...@openmailbox.org>
Date: Fri, 25 Sep 2015 00:37:36 +0200
Subject: [PATCH] lint: Fix missing warning symbol.

* guix/scripts/lint.scm (check-description-style): Set 'field' parameter
  when emitting a warning in 'check-texinfo-markup'.  This is a followup
  to commit 2748ee3.
---
 guix/scripts/lint.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index b0427f7..0adb3bf 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -146,11 +146,11 @@ monad."
   (define (check-texinfo-markup description)
     "Check that DESCRIPTION can be parsed as a Texinfo fragment.  If the
 markup is valid return a plain-text version of DESCRIPTION, otherwise #f."
-    (catch 'parser-error
-      (lambda () (texi->plain-text description))
-      (lambda (keys . args)
-        (emit-warning package (_ "Texinfo markup in description is invalid"))
-        #f)))
+    (unless (false-if-exception (texi->plain-text description))
+      (emit-warning package
+                    (_ "Texinfo markup in description is invalid")
+                    'description)
+      #f))
 
   (define (check-proper-start description)
     (unless (or (properly-starts-sentence? description)
-- 
2.5.3

Usage of ‘false-if-exception’ made me realize that ‘emit-warning’ is not
nicely composable.  What about making it return ‘#f’ in order to compose
checks and warning together as boolean expressions?  Is that idiomatic?
Maybe you have a better suggestion?

--
Mathieu Lirzin

Reply via email to