Arc Forumnew | comments | leaders | submitlogin
How to make Emacs display Unicode characters in files with an .arc extension?
5 points by gruseom 28 days ago | 4 comments
Emacs ignores the default coding system when opening files with an .arc extension, and thus fails to display Unicode characters. This appears to be because it regards .arc files as archives. How can I override this?

When I open an .arc file, C-h C <enter> indicates that the coding system for the buffer is "no-conversion-multibyte". This is also indicated by an equal sign at the head of the modeline. Since I have the default coding system set to utf-8, changing the file extension from .arc to something else (e.g. .arx) is sufficient to make Unicode characters appear. I can also force an .arc file buffer into utf-8 by invoking revert-buffer-with-coding-system manually, but this is tedious.

The following line in my .emacs sounds like it should help, but doesn't:

  (modify-coding-system-alist 'file "\\.arc$" 'utf-8)
Several of you must have figured this out long ago. What should I do?

Edit: Ah, here's the solution:

  (push '("\\.arc$" . utf-8) auto-coding-alist)
I'll post the links where I found this in a comment below, so they'll be clickable.




4 points by gruseom 28 days ago | link

Ok, this old thread led to the answer:

https://lists.gnu.org/archive/html/help-gnu-emacs/2008-03/ms...

The symptom was different (a copy/paste issue) but the phenomenon was the same (files with .arc extension not behaving normally). The cause is indeed that Emacs thinks .arc means an archive file. The solution is here:

https://lists.gnu.org/archive/html/help-gnu-emacs/2008-03/ms...

The variable you need to change is auto-coding-alist, like this:

  (push '("\\.arc$" . utf-8) auto-coding-alist)
The reason this problem was so confusing is that the settings in auto-coding-alist take precedence over some of the other things that seem like they ought to work but don't, like modify-coding-system-alist (described above) or putting a character-encoding directive like:

  -*- coding: utf-8 -*-
at the top of the file. Since it was surprisingly hard to track this down and I only found it on my dozen-th or so Google search, I'm making this comment verbose in the hope that the current thread will surface more easily in the future.

reply

2 points by akkartik 28 days ago | link

I use Vim as you know, but hopefully somebody else here uses Emacs.

Do you have any Arc-specific configuration in your .emacs? It may be helpful to share that in case somebody spots something wrong with it.

reply

3 points by gruseom 28 days ago | link

Pretty simple:

  (push '("\\.arc$" . lisp-mode) auto-mode-alist)
  (modify-coding-system-alist 'file "\\.arc$" 'utf-8)
There's some other stuff related to running a REPL but I'm pretty sure it's unrelated.

reply

1 point by akkartik 28 days ago | link

Thanks! Sorry I can't be more help, but I can indeed reproduce your issue.

reply