aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-11-09 23:27:56 +0100
committerLudovic Courtès <ludo@gnu.org>2017-11-09 23:54:47 +0100
commit935542fbde17f0bc865cbcbb8d9f632bd592cc96 (patch)
treea85f478c5d3519bf885e9db1e73ef3fba8ef79c0
parentd8f075c3a3daba93ff4420bbe0b1833712aaa0e9 (diff)
downloadguix-935542fbde17f0bc865cbcbb8d9f632bd592cc96.tar
guix-935542fbde17f0bc865cbcbb8d9f632bd592cc96.tar.gz
ui: Add 'display-hint'.
* guix/ui.scm (known-variable-definition): New procedure. (report-load-error): Use it.
-rw-r--r--guix/ui.scm11
1 files changed, 8 insertions, 3 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index a1152605e6..02f3638f3a 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -229,6 +229,13 @@ messages."
(else
#t))))))
+(define* (display-hint message #:optional (port (current-error-port)))
+ "Display MESSAGE, a l10n message possibly containing Texinfo markup, to
+PORT."
+ (format port (G_ "hint: ~a~%")
+ (fill-paragraph (texi->plain-text message)
+ (terminal-columns) 8)))
+
(define* (report-load-error file args #:optional frame)
"Report the failure to load FILE, a user-provided Scheme file.
ARGS is the list of arguments received by the 'throw' handler."
@@ -262,9 +269,7 @@ ARGS is the list of arguments received by the 'throw' handler."
%gettext-domain)))
(report-error (G_ "exception thrown: ~s~%") obj))
(when (fix-hint? obj)
- (format (current-error-port) (G_ "hint: ~a~%")
- (fill-paragraph (texi->plain-text (condition-fix-hint obj))
- (terminal-columns) 8))))
+ (display-hint (condition-fix-hint obj))))
((error args ...)
(report-error (G_ "failed to load '~a':~%") file)
(apply display-error frame (current-error-port) args))))