emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: detecting charset of directories


From: Kevin Rodgers
Subject: Re: detecting charset of directories
Date: Fri, 20 Oct 2006 07:20:38 -0700 (PDT)

Kenichi Handa writes:
> In article <address@hidden>, Kevin Rodgers <address@hidden> writes:
> > > Detecting a coding system of filenames in a directory is
> > > difficult to implement, but it won't be that difficult to
> > > respect a coding system explicitly specified by C-x C-m c
> > > for dired.  Perhaps, it can be done by locally setting
> > > file-name-coding-system of that buffer and making
> > > dired-revert to pay attention to that value.
> 
> > `C-x C-m c' temporarily binds coding-system-for-read and
> > coding-system-for-write, so wouldn't it be more transparent to locally
> > set those variables (in dired-mode, where the other buffer-local
> > variables are set)?
> 
> Those variables are mainly for let-binding by programs.
> Directly setting them may leads to a problem.  For instance,
> qM-x shell-command invoded from that buffer will use those
> values.

I'm not sure shell-command shouldn't use those values in that buffer,
but it does seem safer to set file-name-coding-system instead.

> > Also, how can one ensure that `C-x m c CODING-SYSTEM g' will (1) have
> > its intended effect and (2) persist its effect, for subsequent `g'
> > commands?
> 
> Sorry, I don't understand what you mean.  Could you please
> paraphrase it?

[Sorry, `C-x m c ...' should have been `C-x C-m c ...']

Let's say you are in a Dired buffer and you realize the coding system is
wrong, so you try to re-read it with `C-x RET c CODING-SYSTEM g'.  Does
that work?  If later you decide to simply run `g', does it use
CODING-SYSTEM to re-read the directory?

I think to make that work, dired-revert needs the same fix as
dired-mode, namely:

(set (make-local-variable 'file-name-coding-system)
     (or coding-system-for-read file-name-coding-system))

Or perhaps that should be done later in just one place: dired-readin.

-- 
Kevin









reply via email to

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