* Is it possible directory local settings for file encoding?
@ 2016-10-05 9:38 Oleksandr Gavenko
2016-10-05 13:24 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Oleksandr Gavenko @ 2016-10-05 9:38 UTC (permalink / raw)
To: help-gnu-emacs
I have .rst files with
-*- coding: utf-8 -*-
marker. Is it possible to use special keyword ``coding`` in
``.dir-locals.el``?
--
http://defun.work/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Is it possible directory local settings for file encoding?
2016-10-05 9:38 Is it possible directory local settings for file encoding? Oleksandr Gavenko
@ 2016-10-05 13:24 ` Eli Zaretskii
2016-10-06 14:24 ` Oleksandr Gavenko
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2016-10-05 13:24 UTC (permalink / raw)
To: help-gnu-emacs
> From: Oleksandr Gavenko <gavenkoa@gmail.com>
> Date: Wed, 05 Oct 2016 12:38:19 +0300
>
> marker. Is it possible to use special keyword ``coding`` in
> ``.dir-locals.el``?
You have file-coding-alist to match against file names, so why do you
need the 'coding:' thing?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Is it possible directory local settings for file encoding?
2016-10-05 13:24 ` Eli Zaretskii
@ 2016-10-06 14:24 ` Oleksandr Gavenko
0 siblings, 0 replies; 3+ messages in thread
From: Oleksandr Gavenko @ 2016-10-06 14:24 UTC (permalink / raw)
To: help-gnu-emacs
On 2016-10-05, Eli Zaretskii wrote:
> You have file-coding-alist to match against file names, so why do you
> need the 'coding:' thing?
>
I didn't find ``file-coding-alist`` but ``file-coding-system-alist`` and it
satisfy my needs with:
(add-to-list 'file-coding-system-alist '("\\.rst\\'" . prefer-utf-8-unix))
or may be better:
(modify-coding-system-alist 'file "\\.rst\\'" 'prefer-utf-8-unix)
Also I found:
auto-coding-alist is a variable defined in `mule.el'.
but it have precedence over `coding:' so less valuable for my purpose:
The settings in this alist take priority over `coding:' tags
in the file (see the function `set-auto-coding')
and the contents of `file-coding-system-alist'.
================================================================
>> From: Oleksandr Gavenko <gavenkoa@gmail.com>
>> marker. Is it possible to use special keyword ``coding`` in
>> ``.dir-locals.el``?
Hm... I had in my ``.emacs``:
(defun my--c++-header-file-p ()
"Return non-nil, if in a C++ header."
(and (string-match "\\.h$"
(or (buffer-file-name)
(buffer-name)))
(save-excursion
(re-search-forward "\\_<class\\_>" nil t))))
(add-to-list 'magic-mode-alist '(my--c++-header-file-p . c++-mode))
Therefore coding system must be defined before buffer major mode
(``re-search-forward`` relay on buffer encoding).
So my original request is meaningless.
================================================================
What about per project settings for ``file-coding-system-alist``?
I mean that this settings is carried inside project hierarchy instead of
putting absolute paths or guessing prefixes in global ``~/.emacs``?
--
http://defun.work/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-06 14:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-05 9:38 Is it possible directory local settings for file encoding? Oleksandr Gavenko
2016-10-05 13:24 ` Eli Zaretskii
2016-10-06 14:24 ` Oleksandr Gavenko
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.