[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: File name completion on Mac OS X with German umlauts
From: |
Nikolaj Schumacher |
Subject: |
Re: File name completion on Mac OS X with German umlauts |
Date: |
Mon, 17 Mar 2008 17:44:31 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.92 (darwin) |
Piet van Oostrum <piet@cs.uu.nl> wrote:
>>NS> Emacs must also be doing some normalization... switch-to-buffer
>>NS> completion works on "rückerstattung" after all. Only `read-file-name'
>>NS> doesn't. Hmm, maybe this /is/ an Emacs bug after all.
>
> No, it doesn't do normalization. For buffers it is the same as for
> filenames. But usually you don't have normalized buffer names (except for
> those where normalized is the same as unnormalized of course). When you
> create a file with name rückerstattung on OS X and open it from a directory
> listing (where it shows as rückerstattung) you get a buffer name
> rückerstattung. This will not complete from rü.
Ah, well, I didn't verify my claim with emacs -q.
I have
(require 'utf-8m)
(setq file-name-coding-system 'utf-8m))
in my .emacs, which apparently makes all of that work.
This is very interesting. Apparently `read-file-name' doesn't use
`file-name-coding-system' when completing.
More interestingly, functions like `directory-files' do. Thus, I was
able to hack up this alternative to `find-file':
(defun my-complete-file-name (input ignored all-p)
(let* ((dir (or (file-name-directory input) default-directory))
(file (file-name-nondirectory input))
(dir-files (directory-files dir nil (concat "^" file))))
(if all-p
(mapcar (lambda (file) (if (file-is-dir-p file)
(file-name-as-directory file)
file))
(all-completions file dir-files))
(let ((completion (try-completion file dir-files)))
(if (not (stringp completion))
completion
(setq completion (concat dir completion))
(if (file-is-dir-p completion)
(file-name-as-directory completion)
completion))))))
(defun my-find-file ()
(interactive)
(completing-read "Find file: " 'my-complete-file-name nil nil "~/"))
It's pretty rough and much slower than the original, but it will
correctly complete "rü".
regards,
Nikolaj Schumacher
- Re: File name completion on Mac OS X with German umlauts, (continued)
- Re: File name completion on Mac OS X with German umlauts, Eli Zaretskii, 2008/03/13
- Re: File name completion on Mac OS X with German umlauts, Juanma Barranquero, 2008/03/13
- Re: File name completion on Mac OS X with German umlauts, Nikolaj Schumacher, 2008/03/13
- Re: File name completion on Mac OS X with German umlauts, Juanma Barranquero, 2008/03/13
- Re: File name completion on Mac OS X with German umlauts, Juanma Barranquero, 2008/03/13
- Re: File name completion on Mac OS X with German umlauts, Eli Zaretskii, 2008/03/13
- Re: File name completion on Mac OS X with German umlauts, Juanma Barranquero, 2008/03/13
- Message not available
- Re: File name completion on Mac OS X with German umlauts, Markus, 2008/03/13
- Re: File name completion on Mac OS X with German umlauts, Peter Dyballa, 2008/03/13
- Message not available
- Re: File name completion on Mac OS X with German umlauts, Piet van Oostrum, 2008/03/17
- Re: File name completion on Mac OS X with German umlauts,
Nikolaj Schumacher <=
- Re: File name completion on Mac OS X with German umlauts, Eli Zaretskii, 2008/03/17
- Re: File name completion on Mac OS X with German umlauts, Nikolaj Schumacher, 2008/03/18