[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Enhanced 'warning'
From: |
Nikita Karetnikov |
Subject: |
Re: Enhanced 'warning' |
Date: |
Thu, 18 Apr 2013 23:27:48 +0400 |
> You should reuse the body of the current ‘warning’ macro, though.
What's wrong with this macro?
(define-syntax define-diagnostic
(syntax-rules ()
((define-diagnostic name prefix)
(define-syntax name
(lambda (x)
(define (augmented-format-string fmt)
(string-append "~:[~*~;guix ~a: ~]~a" (syntax->datum fmt)))
(syntax-case x (N_ _) ; these are literals, yeah...
((name (_ fmt) args ...)
(string? (syntax->datum #'fmt))
(with-syntax ((fmt* (augmented-format-string #'fmt))
(prefix (datum->syntax x prefix)))
#'(format (guix-warning-port) (gettext fmt*)
(program-name) (program-name) prefix
args ...)))
((name (N_ singular plural n) args ...)
(and (string? (syntax->datum #'singular))
(string? (syntax->datum #'plural)))
(with-syntax ((s (augmented-format-string #'singular))
(p (augmented-format-string #'plural))
(prefix (datum->syntax x prefix)))
#'(format (guix-warning-port)
(ngettext s p n %gettext-domain)
(program-name) (program-name) prefix
args ...)))))))))
I'm getting the "extra ellipsis in form" error.
pgplVn82aK7ha.pgp
Description: PGP signature
- Re: [PATCH] Add 'guix hash'., (continued)
- Re: [PATCH] Add 'guix hash'., Ludovic Courtès, 2013/04/10
- Re: [PATCH] Add 'guix hash'., Ludovic Courtès, 2013/04/05
- Re: [PATCH] Add 'guix hash'., Nikita Karetnikov, 2013/04/09
- Re: [PATCH] Add 'guix hash'., Ludovic Courtès, 2013/04/11
- master: FAIL: tests/guix-package.sh (was: [PATCH] Add 'guix hash'.), Nikita Karetnikov, 2013/04/12
- Re: master: FAIL: tests/guix-package.sh, Nikita Karetnikov, 2013/04/12
- Re: master: FAIL: tests/guix-package.sh, Ludovic Courtès, 2013/04/12
- Enhanced 'warning' (was: [PATCH] Add 'guix hash'.), Nikita Karetnikov, 2013/04/18
- Re: Enhanced 'warning', Nikita Karetnikov, 2013/04/18
- Re: Enhanced 'warning', Ludovic Courtès, 2013/04/18
- Re: Enhanced 'warning',
Nikita Karetnikov <=
- Re: Enhanced 'warning', Ludovic Courtès, 2013/04/18
- [PATCH] ui: Add a 'define-diagnostic' macro. (was: Enhanced 'warning'), Nikita Karetnikov, 2013/04/19
- Re: [PATCH] ui: Add a 'define-diagnostic' macro., Nikita Karetnikov, 2013/04/20
- Re: [PATCH] ui: Add a 'define-diagnostic' macro., Ludovic Courtès, 2013/04/20
- Re: [PATCH] ui: Add a 'define-diagnostic' macro., Nikita Karetnikov, 2013/04/20
- Re: [PATCH] ui: Add a 'define-diagnostic' macro., Ludovic Courtès, 2013/04/20
- Re: [PATCH] ui: Add a 'define-diagnostic' macro., Ludovic Courtès, 2013/04/20
- Re: [PATCH] Add 'guix hash'., Nikita Karetnikov, 2013/04/21
- Re: [PATCH] Add 'guix hash'., Ludovic Courtès, 2013/04/21