Subject: bug#53729: 29.0.50; Tamil text not shaped in modeline

From: Eli Zaretskii <[email-masked]>
Date: Mon, 14 Feb 2022 16:05:53 +0200

> From: Visuwesh <[email-masked]>
> Cc: [email-masked]
> Date: Mon, 14 Feb 2022 08:31:38 +0530
> 
> >> If I turn off global-auto-composition-mode and do the above, none of the
> >> text is shaped i.e., the buffer name produced by me and the buffer name
> >> produced by Emacs both are not shaped.
> >
> > Of course they aren't shaped: turning off auto-composition-mode
> > disables the shaping.  I'm asking whether both the buffer name
> > produced by you and the buffer name produced by visiting that file
> > look identical on the mode line, or do they somehow differ?  If they
> > do differ, what is the difference?
> >
> 
> I misunderstood what you meant, sorry.  They look the same.

And what does Emacs display if you evaluate the below in the buffer
whose file name is displayed on the mode line improperly:

  (append (file-name-nondirectory (buffer-file-name)) nil)

This should produce the list of character codes that constitute the
file name; I want to see that there's no strange characters in the
file name.

> >> I did this out of curiosity: in dired, I typed C M-n when over the file
> >> and added ".1" to the end of new file name, and when I visit this file,
> >> the buffer name is shaped properly.  [ The new filename is
> >> அக்னிச்சிறகுகள்.pdf.1 ]
> >
> > So you are saying that changing the file-name extension affects the
> > shaping on the mode line?
> 
> Yes, that seems to be the case.  I tried changing the extension to
> "jpeg", and the shaping was incorrect.  If I completely remove the
> extension, the text is shaped properly.

Looks like the rendering of the file name is affected by the non-Tamil
text that follows it?

If you display the mode-line text as a string, does it display
correctly?  Here's how to do that: evaluate:

  (let ((str (format-mode-line mode-line-format)))
    (remove-list-of-text-properties 0 (length str) '(help-echo face mouse-face local-map display keymap) str) str)

> I'm not sure if that's the case.  If I rename that file in Emacs to
> "வணக்கம்.pdf", the text is not shaped properly again.
> 
> Also, I found out that non-empty files (with Tamil names) don't have
> their buffer name shaped properly.  If I create a new empty file in
> dired, the buffer name is shaped properly but that is not the case if I
> rename an existing, non-empty file.

Again sounds like what's else on the mode line somehow affects the
rendering of the Tamil file name.

But I cannot reproduce this on my system, so it is hard to tell what
is going on here.