all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Always use UTF-8 mode with certain files
@ 2013-04-23 12:25 Juha Nieminen
  2013-04-23 17:07 ` Steven Degutis
  2013-04-23 19:02 ` Peter Dyballa
  0 siblings, 2 replies; 3+ messages in thread
From: Juha Nieminen @ 2013-04-23 12:25 UTC (permalink / raw)
  To: help-gnu-emacs

Hello.

I would like for emacs to always use UTF-8 mode when opening certain
files (similarly as to what happens if I do a C-x C-m r utf-8, but
just when normally opening a file.) For example I would like this to
be the case when opening files with extensions .m, .mm and .h.

I don't know what to write in the .emacs file for this to happen. (And
obviously it shouldn't interfere with any other hooks that are
triggered when opening such files...)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Always use UTF-8 mode with certain files
  2013-04-23 12:25 Always use UTF-8 mode with certain files Juha Nieminen
@ 2013-04-23 17:07 ` Steven Degutis
  2013-04-23 19:02 ` Peter Dyballa
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Degutis @ 2013-04-23 17:07 UTC (permalink / raw)
  To: Juha Nieminen; +Cc: help-gnu-emacs@gnu.org

This isn't a direct answer to the question, but I would point you to
tip #1 in https://github.com/sdegutis/using-emacs#tips-about-pragmaticism

-Steven

On Tue, Apr 23, 2013 at 7:25 AM, Juha Nieminen <juha.nieminen@gmail.com> wrote:
> Hello.
>
> I would like for emacs to always use UTF-8 mode when opening certain
> files (similarly as to what happens if I do a C-x C-m r utf-8, but
> just when normally opening a file.) For example I would like this to
> be the case when opening files with extensions .m, .mm and .h.
>
> I don't know what to write in the .emacs file for this to happen. (And
> obviously it shouldn't interfere with any other hooks that are
> triggered when opening such files...)
>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Always use UTF-8 mode with certain files
  2013-04-23 12:25 Always use UTF-8 mode with certain files Juha Nieminen
  2013-04-23 17:07 ` Steven Degutis
@ 2013-04-23 19:02 ` Peter Dyballa
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Dyballa @ 2013-04-23 19:02 UTC (permalink / raw)
  To: Juha Nieminen; +Cc: help-gnu-emacs


Am 23.04.2013 um 14:25 schrieb Juha Nieminen:

> I would like for emacs to always use UTF-8 mode when opening certain files

You can open all files, except they have local variables set or similar settings to open in a different encoding, by setting in your environment LANG and LC_CTYPE to some UTF-8 value. In your init file you can set additionally:

	(prefer-coding-system 'utf-8)

For /some/ instead of all file types you could use statements à la:

	(add-to-list 'file-coding-system-alist '("\\.m\\'" . utf-8)) 

--
Greetings

  Pete

We have to expect it, otherwise we would be surprised.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-23 19:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23 12:25 Always use UTF-8 mode with certain files Juha Nieminen
2013-04-23 17:07 ` Steven Degutis
2013-04-23 19:02 ` Peter Dyballa

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.