emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#19590: closed (24.4; Window titles non-Unicode)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#19590: closed (24.4; Window titles non-Unicode)
Date: Wed, 14 Jan 2015 18:18:02 +0000

Your message dated Wed, 14 Jan 2015 20:17:16 +0200
with message-id <address@hidden>
and subject line Re: bug#19590: 24.4; Window titles non-Unicode
has caused the debbugs.gnu.org bug report #19590,
regarding 24.4; Window titles non-Unicode
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
19590: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19590
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.4; Window titles non-Unicode Date: Tue, 13 Jan 2015 11:41:49 -0800 User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

I'm delighted that emacs 24.4 can, at long last, actually open files
with any characters in their names. However, when it opens one that it
previously couldn't (because the character is not in the current ANSI
set), the display of the file name in the title bar has such characters
omitted.



In GNU Emacs 24.4.1 (x86_64-w64-mingw32)
 of 2014-10-20 on KAEL
Windowing system distributor `Microsoft Corp.', version 6.1.7601
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-xft --with-sound=yes --with-file-notification=yes
 --without-dbus --without-imagemagick 'CFLAGS=-Ofast
 -fomit-frame-pointer -funroll-loops -g0 -pipe' 'CPPFLAGS=-DNDEBUG
 -DDBUS_STATIC_BUILD' 'LDFLAGS=-static-libgcc -static-libstdc++ -static
 -s -Wl,-s''

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1252

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  which-function-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-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
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-SPC C-f
C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f
C-f C-f <escape> w C-x k <return> <help-echo> <down-mouse-1>
<mouse-1> C-x C-f d : \ m y \ p y \ b i x u <tab> .
<tab> <return> C-e C-b DEL 3 C-a C-a <down-mouse-1>
<mouse-1> C-a C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-e <return> # SPC SPC SPC SPC ( b u t SPC s e
a r c h i n g <backspace> <backspace> <backspace> a
b l <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
i n d e x SPC l i s t s SPC a n d <backspace> <backspace>
e <backspace> r e SPC s e a r c h a b l e SPC u s i
n g SPC b r o w s e r SPC s e a r c h ) C-a C-a C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-p C-n C-e C-b C-b C-b C-b C-b C-b SPC s p
w 2 b i C-p C-a C-k C-k C-n C-n C-n C-p C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-k
C-k C-k C-k C-k C-k C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-x C-s C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-p C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-p C-k C-k C-x C-s <help-echo>
<help-echo> <escape> x r c <return> <help-echo> <escape>
x r e p o r t - e m a c s - b u g <return>

Recent messages:
Wrote e:/!AC+/hymn_concordance/master/Hymns.română.Cântări vechi şi noi 2013.master.txt
Mark set
Mark saved where search started
Mark set
Warning: no abbrev-file found, customize `abbrev-file-name' in order to make mode-specific abbrevs work.
which-func-ff-hook error: (error "Variable binding depth exceeds max-specpdl-size")
Saving file d:/my/py/bixutls.py...
Wrote d:/my/py/bixutls.py
Saving file d:/my/py/bixutls.py...
Wrote d:/my/py/bixutls.py

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils add-log python-mode derived skeleton advice
help-fns edmacro kmacro cl-macs thingatpt flymake rx shell pcomplete
cc-cmds cc-engine cc-vars cc-defs compile cl gv cl-loaddefs cl-lib
comint ansi-color ring misearch multi-isearch help-mode easymenu
whitespace which-func imenu 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 167878 15560)
 (symbols 56 23482 0)
 (miscs 48 87 149)
 (strings 32 28200 6365)
 (string-bytes 1 967116)
 (vectors 16 21052)
 (vector-slots 8 1290500 204197)
 (floats 8 71 463)
 (intervals 56 772 19)
 (buffers 960 15))


--- End Message ---
--- Begin Message --- Subject: Re: bug#19590: 24.4; Window titles non-Unicode Date: Wed, 14 Jan 2015 20:17:16 +0200
> Date: Tue, 13 Jan 2015 11:41:49 -0800
> From: Glenn Linderman <address@hidden>
> 
> I'm delighted that emacs 24.4 can, at long last, actually open files
> with any characters in their names. However, when it opens one that it
> previously couldn't (because the character is not in the current ANSI
> set), the display of the file name in the title bar has such characters
> omitted.

Thanks, this is now fixed for the next release.  The diffs are below,
in case you build your own Emacs.

commit 61cc7bf8c4059e0243903752189a13c88cc2cee5
Author: Eli Zaretskii <address@hidden>
Date:   Wed Jan 14 20:14:02 2015 +0200

    Fix support of non-ASCII frame titles on MS-Windows  (Bug#19590)
    
     src/w32fns.c (w32_set_title_bar_text): New function, including
     support for titles with non-ASCII characters outside of the
     current system codepage.
     (x_set_name, x_set_title): Use it.

diff --git a/src/ChangeLog b/src/ChangeLog
index 6296302..a90cc41 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-14  Eli Zaretskii  <address@hidden>
+
+       * w32fns.c (w32_set_title_bar_text): New function, including
+       support for titles with non-ASCII characters outside of the
+       current system codepage.
+       (x_set_name, x_set_title): Use it.  (Bug#19590)
+
 2015-01-10  Eli Zaretskii  <address@hidden>
 
        * indent.c (Fvertical_motion): Return zero if we started from ZV
diff --git a/src/w32fns.c b/src/w32fns.c
index 412e91e..5af36b9 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1732,6 +1732,50 @@ struct frame *
   run_window_configuration_change_hook (f);
 }
 
+static void
+w32_set_title_bar_text (struct frame *f, Lisp_Object name)
+{
+  if (FRAME_W32_WINDOW (f))
+    {
+      block_input ();
+#ifdef __CYGWIN__
+      GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f),
+                              GUI_SDATA (GUI_ENCODE_SYSTEM (name)));
+#else
+      /* The frame's title many times shows the name of the file
+        visited in the selected window's buffer, so it makes sense to
+        support non-ASCII characters outside of the current system
+        codepage in the title.  */
+      if (w32_unicode_filenames)
+       {
+         Lisp_Object encoded_title = ENCODE_UTF_8 (name);
+         wchar_t *title_w;
+         int tlen = pMultiByteToWideChar (CP_UTF8, 0, SSDATA (encoded_title),
+                                          -1, NULL, 0);
+
+         if (tlen > 0)
+           {
+             /* Windows truncates the title text beyond what fits on
+                a single line, so we can limit the length to some
+                reasonably large value, and use alloca.  */
+             if (tlen > 10000)
+               tlen = 10000;
+             title_w = alloca ((tlen + 1) * sizeof (wchar_t));
+             pMultiByteToWideChar (CP_UTF8, 0, SSDATA (encoded_title), -1,
+                                   title_w, tlen);
+             title_w[tlen] = L'\0';
+             SetWindowTextW (FRAME_W32_WINDOW (f), title_w);
+           }
+         else  /* Conversion to UTF-16 failed, so we punt.  */
+           SetWindowTextA (FRAME_W32_WINDOW (f),
+                           SSDATA (ENCODE_SYSTEM (name)));
+       }
+      else
+       SetWindowTextA (FRAME_W32_WINDOW (f), SSDATA (ENCODE_SYSTEM (name)));
+#endif
+      unblock_input ();
+    }
+}
 
 /* Change the name of frame F to NAME.  If NAME is nil, set F's name to
        w32_id_name.
@@ -1785,13 +1829,7 @@ struct frame *
   if (! NILP (f->title))
     name = f->title;
 
-  if (FRAME_W32_WINDOW (f))
-    {
-      block_input ();
-      GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f),
-                              GUI_SDATA (GUI_ENCODE_SYSTEM (name)));
-      unblock_input ();
-    }
+  w32_set_title_bar_text (f, name);
 }
 
 /* This function should be called when the user's lisp code has
@@ -1829,13 +1867,7 @@ struct frame *
   if (NILP (name))
     name = f->name;
 
-  if (FRAME_W32_WINDOW (f))
-    {
-      block_input ();
-      GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f),
-                              GUI_SDATA (GUI_ENCODE_SYSTEM (name)));
-      unblock_input ();
-    }
+  w32_set_title_bar_text (f, name);
 }
 
 void


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]