0

I have my Emacs working in a manjaro (based on arch linux) and the languaage set catalan. It is working well, but I had a problem with dired buffers showing weird symbols and solved adding this configuration to early-init file:

(setq enable-recursive-minibuffers t
      inhibit-startup-message t
      default-file-name-coding-system 'utf-8
      prefer-coding-system 'utf-8
      completion-auto-help 'visible
      completion-auto-select 'nil
      eval-expression-print-maximum-character #x10fffff)

but when I use git in the console I get this (using vim as editor):

    ~/.emacs.vanilla.d    master +1  git status                                                              ✔ 
En la branca master
Canvis a cometre:
  (useu «git restore --staged <fitxer>...» per a fer «unstage»)
        modificat:        early-init.el

    ~/.emacs.vanilla.d    master +1  git commit                                                              ✔ 
S'està avortant la comissió a causa d'un missatge de comissió buit.

inside vim:

# Introduïu el missatge de comissió dels vostres canvis.
# S'ignoraran les línies que comencin amb «#». Un missatge de
# comissió buit avorta la comissió.
#
# En la branca master
# Canvis a cometre:
#       modificat:        early-init.el
#
~
    ...
~

"/home/toni/.emacs.vanilla.d/.git/COMMIT_EDITMSG" 9 lines, 243 characters 

if I use emacs as editor or I write this text in emacs or opn a file containing this letters it works well "ï"

but when I use magit I get this:

emacs commit buffer with magit

how can I solve this?

shynur
  • 4,065
  • 1
  • 3
  • 23
anquegi
  • 739
  • 5
  • 21

1 Answers1

0

As comented by @db48x, the correct anwer for this is add to my early-init.el file this setting:

(set-language-environment 'utf-8)

This is also the suggestion in doom emacs configuration: https://github.com/doomemacs/doomemacs/blob/7a7503045850ea83f205de6e71e6d886187f4a22/lisp/doom-start.el#L131

https://www.gnu.org/software/emacs/manual/html_node/emacs/Language-Environments.html

This also allows you to remove all the other forced encodings to UTF-8 and should be the correct configuration. If you need to configure all

so please use this setting in your emacs custom configuration

Revert buffer with coding system

anquegi
  • 739
  • 5
  • 21
  • 1
    Please replace all of that with just `(set-language-environment 'utf-8)`. Telling people to set six different settings makes it all look a lot more complex than it really is; even worse it leaves out some settings that could get out of sync and confuse people even more. Even then, since UTF-8 has been the default in Emacs for ages you shouldn’t have to change anything. I'd be willing to bet that if you ran `emacs -Q` then magit would work perfectly. – db48x Aug 22 '23 at 11:26
  • Thanks for this update, I will test it and change – anquegi Aug 22 '23 at 12:10