Using the message-box fn, I can display a modal dialog.
I know this is annoying and not always a good user experience. Flymake’s use of the message-box to warn when a flymake check has failed, seems a good example of that.
But put the user experience issue aside for the purposes of this question. Assume that I am sensible enough to use message-box responsibly.
How can I format the text displayed by the message box? The simplest case is, how can I tell message box to display multiple lines of text. If I have a longish message, it results in a very wide message box. (Another UI problem exhibited in the Flymake usage).
See here for an example. this code:
(message-box (concat "You need to get an \"api key\".<NL>"
"Then, set it in your .emacs with the appropriate statement."))
results in this UI:
I’d like a newline in place of the <NL>. I tried using \n and \r and \r\n, none of those worked. I also tried \x000D and \x000A.
Even better than simple line breaks, I’d like to be able to format the text. Italic, bold, or whatever. Are there options? Nothing is mentioned in the doc on this.
I looked in the source to try to figure this out but could not find message2, which is called by message-box, and I’m not sure I’d learn anything anyway by just looking at source.
Use
\n. That does the trick: