I set up this duplicate line function: https://kundeveloper.com/blog/duplicate-line/

and bound it to the euro symbol like this:

(global-set-key (kbd "M-€") 'duplicate-line)

And it worked (for a while). On my keyboard, left alt + right alt + 4.

However, all of a sudden, when I restarted, it started to give me the following error:

enter image description here

error: M- must prefix a single character, not \342\202\254

and when I look in my init.el file, it also looks likes this

enter image description here

but if I copy that from init.el and paste it into stack overflow (as I did at the start of this question) I get the € back!

Does anybody know what I might have changed about my emacs or ubuntu to stop it accepting € as a key?

btw I still get this nice message when I try to use it:

enter image description here

  • Have you changed your preferences related to the preferred coding system recently? I assume that's the cause of your problem. – user12563 Mar 16 '19 at 21:54
  • No, not that I know of – Alex028502 Mar 16 '19 at 22:06
  • Maybe you've changed your locale, or some update has. – user12563 Mar 16 '19 at 22:07

I suggest you make sure that your locale (as set from where you launch Emacs) is a utf-8 locale. As a workaround you can also put ;; -*- coding: utf-8 -*- on the first line of your file. In Emacs-26, none of that should be needed because Elisp files are presumed to be utf-8 regardless of locale.

  • I am using emacs 26. Not sure what changed. This worked great though. – Alex028502 Mar 17 '19 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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