help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to set file coding system but using per directory variables


From: Andreas Röhler
Subject: Re: how to set file coding system but using per directory variables
Date: Tue, 04 Mar 2014 07:49:04 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

Am 01.03.2014 13:54, schrieb Paul K:
when I add following as first llne in a buffer it is properly interpretted

-*- coding: windows-1250-dos -*-


I don't want to add any headers to files though, so I created
.dir-locals.el file with following content:
((nil . ((buffer-file-coding-system . windows-1250-dos)
          (coding-system-for-read . windows-1250-dos)
          (coding-system-for-write . windows-1250-dos))))


then when I open file coding system is not automatically converted, I need
to do extra buffer reverting for declared coding system to be applied.

do You have any ideas?

best regards,


Maybe needs a string - "windows-1250-dos" ?

Alternatively - Would it help to define it at the end of buffer instead?

;; Local Variables:
;; coding: windows-1250-dos
;; End:

Also employing tweaked find-file command seems possible:

(defun find-file-windows-1250-dos (filename &optional wildcards)
  "Edit file FILENAME using coding-system windows-1250-dos.

See find-file for documentation"
  (interactive
   (find-file-read-args "Find file: "
                        (confirm-nonexistent-file-or-buffer)))
  (let ((coding-system-for-read 'windows-1250-dos)
        (coding-system-for-write 'windows-1250-dos)
        (value (find-file-noselect filename nil nil wildcards)))
    (if (listp value)
        (mapcar 'switch-to-buffer (nreverse value))
      (switch-to-buffer value))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]