Skip to content

Fix treemacs-git-commit-diff-mode when a non-English locale is set#1155

Merged
Alexander-Miller merged 1 commit intoAlexander-Miller:masterfrom
L3n41c:fix_locale
Sep 7, 2025
Merged

Fix treemacs-git-commit-diff-mode when a non-English locale is set#1155
Alexander-Miller merged 1 commit intoAlexander-Miller:masterfrom
L3n41c:fix_locale

Conversation

@L3n41c
Copy link
Copy Markdown
Contributor

@L3n41c L3n41c commented May 10, 2025

Some features like treemacs-git-commit-diff-mode are broken when a non-English locale is set.
This is due to the parsing logic contained in the Python scripts which expect git commands output to be in English.

Ex.:

$ locale
LANG=fr_FR.utf8
LC_CTYPE="fr_FR.utf8"
LC_NUMERIC="fr_FR.utf8"
LC_TIME="fr_FR.utf8"
LC_COLLATE="fr_FR.utf8"
LC_MONETARY="fr_FR.utf8"
LC_MESSAGES="fr_FR.utf8"
LC_PAPER="fr_FR.utf8"
LC_NAME="fr_FR.utf8"
LC_ADDRESS="fr_FR.utf8"
LC_TELEPHONE="fr_FR.utf8"
LC_MEASUREMENT="fr_FR.utf8"
LC_IDENTIFICATION="fr_FR.utf8"
LC_ALL=

$ git status -sb
## master...origin/master [devant 11]


$ python ~/.config/emacs/elpa/treemacs-20250423.2024/treemacs-git-commit-diff.py git .
#(" ↑0 ↓0" 0 4 (face treemacs-git-commit-diff-face))

$ LC_ALL=C python ~/.config/emacs/elpa/treemacs-20250423.2024/treemacs-git-commit-diff.py git .
#(" ↑11" 0 4 (face treemacs-git-commit-diff-face))

$ python ~/.config/emacs/elpa/treemacs-20250423.2024/treemacs-find-ignored-files.py git .
(".""./Supprimerait #git#"".""./Supprimerait .dir-locals.el~"".""./Supprimerait ansible-libvirt.cfg~"".""./Supprimerait archlinux.yml~"…

$ LC_ALL=C python ~/.config/emacs/elpa/treemacs-20250423.2024/treemacs-find-ignored-files.py git .
(".""./#git#"".""./.dir-locals.el~"".""./ansible-libvirt.cfg~"".""./archlinux.yml~"…

treemacs-git-commit-diff.py and treemacs-find-ignored-files.py are two examples of scripts that are not working properly when a non-English locale is set.
git commands executed with --procelain shouldn’t be affected by this issue. But for consistency, I decided to explicitly reset the locale for all the commands run by all the Python scripts.

(*) “devant” is the french translation of “ahead” and “Supprimerait” is the french translation of “Would remove”.

@L3n41c
Copy link
Copy Markdown
Contributor Author

L3n41c commented Jun 26, 2025

Hello @Alexander-Miller!

I was wondering if you had any chance to have a look at this fix?

@Alexander-Miller
Copy link
Copy Markdown
Owner

👍

@Alexander-Miller Alexander-Miller merged commit 2dd6d86 into Alexander-Miller:master Sep 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants