GNU bug report logs -
#20481
24.5; Newlines in message-box output don't work on Windows
Previous Next
To reply to this bug, email your comments to 20481 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Fri, 01 May 2015 03:19:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Adam Connor <adamc55 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 01 May 2015 03:19:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
If I display a message using message-box, newlines seem to be ignored.
For example
(message-box "secret\nmessage")
will show the message "secretmessage". I have also tried \r\n with the
same result.
Not a huge problem but annoying...
In GNU Emacs 24.5.1 (x86_64-w64-mingw32)
of 2015-04-11 on KAEL
Windowing system distributor `Microsoft Corp.', version 6.3.9600
Configured using:
`configure --prefix=/z/emacs --host=x86_64-w64-mingw32
--target=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --with-wide-int
--with-jpeg --with-xpm --with-png --with-tiff --with-rsvg --with-xml2
--with-gnutls --with-sound=yes --with-file-notification=yes
--without-dbus --without-imagemagick 'CFLAGS=-Ofast
-fomit-frame-pointer -funroll-loops -g0 -pipe' 'LDFLAGS=-static-libgcc
-static-libstdc++ -static -s -Wl,-s''
Important settings:
value of $LANG: ENU
locale-coding-system: utf-8
Major mode: Emacs-Lisp
Minor modes in effect:
my-keys-minor-mode: t
tabbar-mwheel-mode: t
tabbar-mode: t
global-nlinum-mode: t
nlinum-mode: t
diff-auto-refine-mode: t
global-undo-tree-mode: t
undo-tree-mode: t
recentf-mode: t
desktop-save-mode: t
tooltip-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
Auto-saving...
Quit
Saving file c:/Users/Adam/.emacs.d/elisp/file-utils.el...
Wrote c:/Users/Adam/.emacs.d/elisp/file-utils.el
file-older-than
Quit
Saving file c:/Users/Adam/.emacs.d/elisp/file-utils.el...
Wrote c:/Users/Adam/.emacs.d/elisp/file-utils.el
file-older-than
Wrote c:/Users/Adam/.emacs.d/packages-updated.txt
nil
Load-path shadows:
~/.emacs.d/lib/tabbar-master/revive hides ~/.emacs.d/lib/revive
c:/Users/Adam/.emacs.d/elpa/dash-2.10.0/dash hides ~/.emacs.d/lib/dash
~/.emacs.d/lib/indent hides
c:/dev/emacs-w64-24.5/share/emacs/24.5/lisp/indent
Features:
(shadow sort mail-extr emacsbug sendmail debug eieio-opt speedbar
sb-image ezimage dframe find-func geiser-mode geiser-xref geiser-chicken
geiser-racket geiser-guile geiser-repl geiser-image geiser-compile
geiser-debug geiser-company geiser-doc geiser-menu geiser-autodoc eldoc
info-look geiser geiser-edit etags geiser-completion geiser-eval
geiser-connection tq geiser-syntax rx geiser-log geiser-popup view
geiser-impl geiser-custom geiser-base tar-mode thingatpt cmuscheme
scheme tabify autoload misearch multi-isearch lisp-mnt help-mode
mule-util gnutls mm-archive network-stream starttls url-cache
url-handlers finder-inf vc-git tabbar revbufs fill-column-indicator
nlinum linum virtualenvwrapper dash vc-svn psvn derived log-edit message
format-spec rfc822 mml mml-sec mailabbrev mail-utils gmm-utils
mailheader pcvs-util add-log diff-mode pp elp ediff-merg ediff-wind
ediff-diff ediff-mult ediff-help ediff-init ediff-util dired rdp-utils
web-mode flymake compile python json comint ring ansi-color util
undo-tree soap-client mm-decode mm-bodies mm-encode url-http tls
url-auth mail-parse rfc2231 rfc2047 rfc2045 ietf-drums url-gw url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util url-parse auth-source eieio byte-opt bytecomp
byte-compile cl-extra cconv eieio-core gnus-util mm-util mail-prsvr
password-cache url-vars mailcap warnings xml easy-mmode virtualenv-utils
env-utils proj-utils cl-macs s cl gv ido edmacro kmacro ibuffer
framemove advice help-fns ehelp editorconfig file-utils recentf
tree-widget wid-edit desktop frameset cl-loaddefs cl-lib info easymenu
package epg-config misterioso-theme library-utils time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32
ls-lisp w32-common-fns disp-table w32-win w32-vars tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
w32notify w32 multi-tty emacs)
Memory information:
((conses 16 699525 109272)
(symbols 56 35736 0)
(miscs 48 3413 2679)
(strings 32 87577 14382)
(string-bytes 1 2273331)
(vectors 16 37061)
(vector-slots 8 1409654 155048)
(floats 8 159 939)
(intervals 56 66830 766)
(buffers 960 23))
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Fri, 01 May 2015 07:20:04 GMT)
Full text and
rfc822 format available.
Message #8 received at 20481 <at> debbugs.gnu.org (full text, mbox):
> From: Adam Connor <adamc55 <at> gmail.com>
> Date: Thu, 30 Apr 2015 22:18:13 -0500
>
> If I display a message using message-box, newlines seem to be ignored.
> For example
> (message-box "secret\nmessage")
>
> will show the message "secretmessage". I have also tried \r\n with the
> same result.
>
> Not a huge problem but annoying...
Emacs on Windows doesn't really support message boxes (a.k.a. "dialog
boxes"), except for simple Yes/No questions popped up by yes-or-no-p.
For other messages, such as this one, Emacs on Windows emulates dialog
boxes by menus, and in a menu an item cannot contain a newline.
In this case, we faithfully pass the original string with a newline to
the MS-Windows menu API, and I believe it is dropped by Windows when
it displays the menu.
IOW, this is a missing feature: dialog boxes are not fully supported
on MS-Windows.
Severity set to 'wishlist' from 'normal'
Request was from
Eli Zaretskii <eliz <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Fri, 01 May 2015 07:21:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Sat, 02 May 2015 06:34:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 20481 <at> debbugs.gnu.org (full text, mbox):
> From: Adam Connor <adamc55 <at> gmail.com>
> Date: Fri, 1 May 2015 15:22:29 -0500
>
> Thanks for explaining. That's unfortunate.
Patches to have Emacs on Windows support dialog boxes are welcome.
There's already code there, currently ifdef'ed away, which is
incomplete and "needs work".
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Mon, 19 Aug 2024 16:15:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 20481 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
This patch adds support on Windows Vista an later for dialog boxes using
TaskDialog.
[patch.diff (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Mon, 19 Aug 2024 17:46:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 20481 <at> debbugs.gnu.org (full text, mbox):
> Date: Mon, 19 Aug 2024 18:13:31 +0200
> From: Cecilio Pardo <cpardo <at> imayhem.com>
>
> This patch adds support on Windows Vista an later for dialog boxes using
> TaskDialog.
Thanks.
First, to accept a contribution of this size we'll need a
copyright-assignment paperwork from you. Should I send you the form
to fill with instructions to go with it, so you could start the
paperwork rolling?
A few comments about the patch:
> + void *task_dialog_indirect =
> + get_proc_addr (GetModuleHandle ("comctl32.dll"), "TaskDialogIndirect");
> +
> + if (task_dialog_indirect)
A minor optimization is to call get_proc_addr only once and save the
result in a static variable. We use this technique in many places in
Emacs, and I see no reason not to do that here.
> + /* Get the title as a UTF-16 string. */
> + CHECK_STRING (XCAR (contents));
> + char *title = SSDATA (XCAR (contents));
> + int wide_length = sizeof(WCHAR) *
> + pMultiByteToWideChar (CP_UTF8, 0, title, -1, NULL, 0);
> + WCHAR *title_text_wide = alloca (wide_length);
> + pMultiByteToWideChar (CP_UTF8, 0, title, -1,
> + title_text_wide, wide_length);
The text of Lisp strings is stored by Emacs in a super-set of UTF-8,
so it cannot be safely passed to MultiByteToWideChar. You need to
encode it in UTF-8 first (use ENCODE_UTF_8).
> + CHECK_STRING (item_name);
> +
> + int wide_length = sizeof(WCHAR) *
> + pMultiByteToWideChar (CP_UTF8, 0, SSDATA (item_name), -1,
> + NULL, 0);
> + buttons[button_count].pszButtonText = alloca (wide_length);
> + pMultiByteToWideChar (CP_UTF8, 0, SSDATA (item_name), -1,
> + (LPWSTR)
> + buttons[button_count].pszButtonText,
> + wide_length);
Same here.
> + else if (NILP (item))
> + {
> + /* A nil item means to put all following items on the
> + right. We ignore this. */
^^ ^^
Our convention is to leave two spaces between sentences in
documentation, comments, and strings. We also leave two spaces at the
end of C comments, before the closing "*/" (here and elsewhere in the
patch).
> + else if (STRINGP(item))
^^
Another stylistic nit: please leave one space between the name of a
function/macro and the opening parenthesis that follows it (here and
elsewhere in the patch).
> + /* A string item means an unselectable button. We add a
> + button, an then need to disable it on the callback.
> + We use ids based on 2000 to mark these buttons */
> + int wide_length = sizeof(WCHAR) *
> + pMultiByteToWideChar (CP_UTF8, 0, SSDATA (item), -1, NULL, 0);
> + buttons[button_count].pszButtonText = alloca (wide_length);
> + pMultiByteToWideChar (CP_UTF8, 0, SSDATA (item), -1,
> + (LPWSTR)
> + buttons[button_count].pszButtonText,
> + wide_length);
UTF-8 encoding again.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Mon, 19 Aug 2024 19:22:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 20481 <at> debbugs.gnu.org (full text, mbox):
On 19/08/2024 19:44, Eli Zaretskii wrote:
>> Date: Mon, 19 Aug 2024 18:13:31 +0200
>> From: Cecilio Pardo <cpardo <at> imayhem.com>
>>
>> This patch adds support on Windows Vista an later for dialog boxes using
>> TaskDialog.
> Thanks.
>
> First, to accept a contribution of this size we'll need a
> copyright-assignment paperwork from you. Should I send you the form
> to fill with instructions to go with it, so you could start the
> paperwork rolling?
Yes, please.
Thanks for your comments.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Wed, 11 Sep 2024 13:45:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 20481 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 19/08/2024 19:44, Eli Zaretskii wrote:
>> Date: Mon, 19 Aug 2024 18:13:31 +0200
>> From: Cecilio Pardo <cpardo <at> imayhem.com>
>>
>> This patch adds support on Windows Vista an later for dialog boxes using
>> TaskDialog.
> Thanks.
>
> First, to accept a contribution of this size we'll need a
> copyright-assignment paperwork from you. Should I send you the form
> to fill with instructions to go with it, so you could start the
> paperwork rolling?
>
> A few comments about the patch:
Hello,
The copyright assignment is ready. Here is the patch with your
comments addressed. I also attach a couple of manual tests.
--
Cecilio Pardo
[patch.diff (text/plain, attachment)]
[test.el (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Thu, 12 Sep 2024 02:51:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 20481 <at> debbugs.gnu.org (full text, mbox):
Cecilio Pardo <cpardo <at> imayhem.com> writes:
> On 19/08/2024 19:44, Eli Zaretskii wrote:
>>> Date: Mon, 19 Aug 2024 18:13:31 +0200
>>> From: Cecilio Pardo <cpardo <at> imayhem.com>
>>>
>>> This patch adds support on Windows Vista an later for dialog boxes using
>>> TaskDialog.
>> Thanks.
>>
>> First, to accept a contribution of this size we'll need a
>> copyright-assignment paperwork from you. Should I send you the form
>> to fill with instructions to go with it, so you could start the
>> paperwork rolling?
>>
>> A few comments about the patch:
>
> Hello,
>
> The copyright assignment is ready. Here is the patch with your
>
> comments addressed. I also attach a couple of manual tests.
>
Thanks. Following are a number of minor stylistic comments.
> + while (!NILP (b)) {
Please insert a newline before this opening brace and indent the same by
one column.
> + if (Fconsp (item))
"if (CONSP (item))"
> + wide_len = sizeof (WCHAR) *
> + pMultiByteToWideChar (CP_UTF8, 0, SSDATA (item_name),
> + -1, NULL, 0);
Please enclose this expression in parens and break it before the
operator, thus:
(sizeof (WCHAR)
* pMultiByteToWideChar (CP_UTF8, 0, SSDATA (...), ...))
> + {
> + /* A nil item means to put all following items on the
> + right. We ignore this. */
> + }
[...]
> + else if (STRINGP (item))
> + {
> + /* A string item means an unselectable button. We add a
> + button, an then need to disable it on the callback.
> + We use ids based on 2000 to mark these buttons. */
Please insert two spaces after sentence stops.
> + Lisp_Object item_name = ENCODE_UTF_8 (item);
> + wide_len = sizeof (WCHAR) *
> + pMultiByteToWideChar (CP_UTF8, 0, SSDATA (item_name),
> + -1, NULL, 0);
What I said about wrapping long expressions also applies here.
> + TASKDIALOGCONFIG config = { };
TASKDIALOGCONFIG config = { 0 };
> + if (!SUCCEEDED (task_dialog_indirect (&config, &pressed_button,
> + NULL, NULL)))
> + return quit ();
This return statement is redundant.
Lastly, I observe that you have implemented a bespoke dialog parser for
Windows, the likes of which have been a source of difficulties in the
past. Is there any particular reason that you decided against
implementing the w32_dialog_show function called in the "#ifdef
HAVE_DIALOGS" version of w32_popup_dialog?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Thu, 12 Sep 2024 13:34:02 GMT)
Full text and
rfc822 format available.
Message #31 received at 20481 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 12/09/2024 4:49, Po Lu wrote:
> Thanks. Following are a number of minor stylistic comments.
Sorry I missed those. They are corrected in the attached patch.
> Lastly, I observe that you have implemented a bespoke dialog parser for
> Windows, the likes of which have been a source of difficulties in the
> past. Is there any particular reason that you decided against
> implementing the w32_dialog_show function called in the "#ifdef
> HAVE_DIALOGS" version of w32_popup_dialog?
I left w32_dialog_show as it was in case an implementation for
older versions of windows became available. I can rewrite it
if you think is better that way.
[patch.diff (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Sat, 14 Sep 2024 11:02:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 20481 <at> debbugs.gnu.org (full text, mbox):
> Date: Thu, 12 Sep 2024 15:33:23 +0200
> From: Cecilio Pardo <cpardo <at> imayhem.com>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 20481 <at> debbugs.gnu.org
>
> On 12/09/2024 4:49, Po Lu wrote:
> > Thanks. Following are a number of minor stylistic comments.
>
> Sorry I missed those. They are corrected in the attached patch.
Thanks, now installed on the master branch (which will become Emacs 31).
FTR, I needed some additions because mingw.org's MinGW lacks some
stuff in its headers that the code used. Please see that the result
still compiles with MinGW64.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Sat, 14 Sep 2024 12:06:02 GMT)
Full text and
rfc822 format available.
Message #37 received at 20481 <at> debbugs.gnu.org (full text, mbox):
Cecilio Pardo <cpardo <at> imayhem.com> writes:
> I left w32_dialog_show as it was in case an implementation for
> older versions of windows became available. I can rewrite it
> if you think is better that way.
I don't think the improvised menu-dialogs and w32_dialog_show are
mutually exclusive. The latter could easily be enabled only on Windows
Vista systems.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Sat, 14 Sep 2024 12:18:02 GMT)
Full text and
rfc822 format available.
Message #40 received at 20481 <at> debbugs.gnu.org (full text, mbox):
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: 20481 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
> Date: Sat, 14 Sep 2024 20:05:03 +0800
>
> Cecilio Pardo <cpardo <at> imayhem.com> writes:
>
> > I left w32_dialog_show as it was in case an implementation for
> > older versions of windows became available. I can rewrite it
> > if you think is better that way.
>
> I don't think the improvised menu-dialogs and w32_dialog_show are
> mutually exclusive. The latter could easily be enabled only on Windows
> Vista systems.
It already is, since on older systems we will be unable to find
TaskDialogIndirect in comctl32.dll, and will fall back to the
menu-dialog implementation. Or what am I missing?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Sat, 14 Sep 2024 14:03:02 GMT)
Full text and
rfc822 format available.
Message #43 received at 20481 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> It already is, since on older systems we will be unable to find
> TaskDialogIndirect in comctl32.dll, and will fall back to the
> menu-dialog implementation. Or what am I missing?
I'm asking for an implementation of w32_popup_dialog that delegates
parsing the menu to `list_of_panes', rather than to a custom parser such
as the function currently implements, so that the dialog parser may be
one and the same across all window systems.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Sat, 14 Sep 2024 14:16:02 GMT)
Full text and
rfc822 format available.
Message #46 received at 20481 <at> debbugs.gnu.org (full text, mbox):
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: cpardo <at> imayhem.com, 20481 <at> debbugs.gnu.org
> Date: Sat, 14 Sep 2024 22:02:25 +0800
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > It already is, since on older systems we will be unable to find
> > TaskDialogIndirect in comctl32.dll, and will fall back to the
> > menu-dialog implementation. Or what am I missing?
>
> I'm asking for an implementation of w32_popup_dialog that delegates
> parsing the menu to `list_of_panes', rather than to a custom parser such
> as the function currently implements, so that the dialog parser may be
> one and the same across all window systems.
Ah, okay. But then this cannot be a job led by a w32-only developer,
it must be a cross-platform job led by someone who knows enough about
the other GUI systems to make the right abstractions.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20481
; Package
emacs
.
(Sat, 14 Sep 2024 15:21:02 GMT)
Full text and
rfc822 format available.
Message #49 received at 20481 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 14 Sep 2024 17:04:49 +0200
> From: Cecilio Pardo <cpardo <at> imayhem.com>
>
> On 14/09/2024 13:00, Eli Zaretskii wrote:
> > Thanks, now installed on the master branch (which will become Emacs 31).
> >
> > FTR, I needed some additions because mingw.org's MinGW lacks some
> > stuff in its headers that the code used. Please see that the result
> > still compiles with MinGW64.
> It does.
Great, thanks.
This bug report was last modified 279 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.