2

I've set up my keyboard layout in arch with

localectl set-x11-keymap us pc104 intl

By default, in this layout, the ' is a dead character. It is called a dead acute. In Portuguese, we are used to composing the ç char using ' + c = ç when using international US-keyboard layouts.

I don't know why, but by default GNU/Linux distros come configured so that when you type this combination ' + c you get ć, which is an invalid char in Brazilian Portuguese.

So I did this. I've edited the following files: sudo vim /usr/lib/gtk-3.0/3.0.0/immodules.cache sudo vim /usr/lib/gtk-2.0/2.10.0/immodules.cache

I change the line:

"cedilla" "Cedilla" "gtk20" "/usr/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa"

to

"cedilla" "Cedilla" "gtk20" "/usr/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa:en"

I also replaced "ć" with "ç" and "Ć" with "Ç" on /usr/share/X11/locale/en_US.UTF-8/Compose:

$ sudo cp /usr/share/X11/locale/en_US.UTF-8/Compose /usr/share/X11/locale/en_US.UTF-8/Compose.bak 

$ sed 's/ć/ç/g' < /usr/share/X11/locale/en_US.UTF-8/Compose | sed 's/Ć/Ç/g' > Compose 
$ sudo mv Compose /usr/share/X11/locale/en_US.UTF-8/Compose

I also added two lines on /etc/environment:

GTK_IM_MODULE=cedilla 
QT_IM_MODULE=cedilla

and then I restarted my computer.

And then it worked. It works fine in firefox, chromium, scite, gvim or any other gui tool. But not in Emacs. In Emacs, ' + c insists on producing ć, despite my efforts.

How can I teach Emacs to produce ç and not ć when I type a dead acute ' + c?

9
  • Which Emacs input method are you using?
    – phils
    Commented Jul 5, 2017 at 2:04
  • I'm using the standard one. the one that is on by default when you don't change anything.
    – ninrod
    Commented Jul 5, 2017 at 12:18
  • The note on the the useXIM X resource in C-h i g (emacs)Table of Resources might be relevant?
    – phils
    Commented Jul 5, 2017 at 12:24
  • hum, gonna check that.
    – ninrod
    Commented Jul 5, 2017 at 13:14
  • ‘useXIM’ (class ‘UseXIM’) Disable use of X input methods (XIM) if ‘false’ or ‘off’. This is only relevant if your Emacs is built with XIM support. It might be useful to turn off XIM on slow X client/server links.
    – ninrod
    Commented Jul 5, 2017 at 13:24

3 Answers 3

1

It looks like the portuguese-prefix input method may be what you're looking for?

e.g. C-uC-\ portuguese-prefix RET (and then C-\ to toggle thereafter).

'c then produces ç

Use C-hC-\ to see the details for an input method.

To configure this as your default input method (i.e. the one that you get by typing just C-\), you would add the following to your init file:

(setq default-input-method "portuguese-prefix")
12
  • C-h i g (emacs)Select Input Method may also be useful to you.
    – phils
    Commented Jul 5, 2017 at 12:27
  • Hum, ok I'll try this!
    – ninrod
    Commented Jul 5, 2017 at 13:01
  • the portuguese prefix did not work. but c-u c-x = with point above ç tells me that C-x 8 RET e7 RET produces ç. It also tells me this:
    – ninrod
    Commented Jul 5, 2017 at 13:16
  • Character code properties: customize what to show name: LATIN SMALL LETTER C WITH CEDILLA old-name: LATIN SMALL LETTER C CEDILLA general-category: Ll (Letter, Lowercase) decomposition: (99 807) ('c' '̧')
    – ninrod
    Commented Jul 5, 2017 at 13:16
  • 1
    A breakthrough: if I launch emacs with this line: LANG=C emacs then it works. see here: lists.gnu.org/archive/html/help-gnu-emacs/2017-07/msg00070.html
    – ninrod
    Commented Jul 5, 2017 at 16:32
0

I got ' c to produce ç with this in my .emacs:

(global-set-key (kbd "<dead-acute> c") (lambda () (interactive) (insert-string "ç")))
1
  • 1
    insert-string was declared obsolete in Emacs-22 and I think it was removed in Emacs-26. Just use insert.
    – Stefan
    Commented Apr 10, 2020 at 15:34
-1

Just put LANG=C before calling your emacs boostrap command.

LANG=C emacs

and it works like a charm.

1
  • It does not work for me.
    – Felipe
    Commented Jun 12, 2019 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.