From: Nikolaj Schumacher <n_schumacher@web.de>
To: Piet van Oostrum <piet@cs.uu.nl>
Cc: help-gnu-emacs@gnu.org
Subject: Re: File name completion on Mac OS X with German umlauts
Date: Mon, 17 Mar 2008 17:44:31 +0100 [thread overview]
Message-ID: <m2k5k18fm8.fsf@nschum.de> (raw)
In-Reply-To: <m2myoxv3y9.fsf@cochabamba.cs.uu.nl> (Piet van Oostrum's message of "Mon\, 17 Mar 2008 15\:07\:58 +0100")
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
next prev parent reply other threads:[~2008-03-17 16:44 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-09 11:53 File name completion on Mac OS X with German umlauts Markus
2008-03-09 14:39 ` Peter Dyballa
2008-03-09 15:22 ` Nikolaj Schumacher
[not found] ` <mailman.8596.1205073587.18990.help-gnu-emacs@gnu.org>
2008-03-09 21:44 ` Markus
2008-03-09 23:21 ` Peter Dyballa
[not found] ` <mailman.8623.1205104885.18990.help-gnu-emacs@gnu.org>
2008-03-10 18:57 ` Markus
2008-03-10 21:01 ` Peter Dyballa
[not found] ` <mailman.8673.1205182919.18990.help-gnu-emacs@gnu.org>
2008-03-10 21:25 ` Markus
2008-03-10 22:49 ` Peter Dyballa
[not found] ` <mailman.8682.1205189384.18990.help-gnu-emacs@gnu.org>
2008-03-11 21:24 ` Markus
2008-03-11 22:14 ` Peter Dyballa
[not found] ` <mailman.8727.1205273706.18990.help-gnu-emacs@gnu.org>
2008-03-13 22:11 ` Markus
2008-03-13 23:11 ` Peter Dyballa
[not found] ` <mailman.8870.1205449910.18990.help-gnu-emacs@gnu.org>
2008-03-16 12:51 ` Markus
2008-03-16 14:21 ` Peter Dyballa
[not found] ` <mailman.8598.1205076134.18990.help-gnu-emacs@gnu.org>
2008-03-09 21:47 ` Markus
2008-03-12 15:44 ` Nikolaj Schumacher
2008-03-12 18:46 ` Eli Zaretskii
2008-03-12 21:25 ` Nikolaj Schumacher
2008-03-12 21:55 ` Eli Zaretskii
2008-03-12 23:23 ` Juanma Barranquero
2008-03-13 4:28 ` Eli Zaretskii
2008-03-13 8:18 ` Juanma Barranquero
2008-03-13 13:49 ` Nikolaj Schumacher
2008-03-13 14:17 ` Juanma Barranquero
2008-03-13 14:18 ` Juanma Barranquero
2008-03-13 20:10 ` Eli Zaretskii
2008-03-13 21:03 ` Juanma Barranquero
[not found] ` <mailman.8859.1205442242.18990.help-gnu-emacs@gnu.org>
2008-03-13 22:09 ` Markus
2008-03-13 23:08 ` Peter Dyballa
[not found] ` <mailman.8794.1205357174.18990.help-gnu-emacs@gnu.org>
2008-03-17 14:07 ` Piet van Oostrum
2008-03-17 16:44 ` Nikolaj Schumacher [this message]
2008-03-17 20:24 ` Eli Zaretskii
2008-03-18 18:05 ` Nikolaj Schumacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2k5k18fm8.fsf@nschum.de \
--to=n_schumacher@web.de \
--cc=help-gnu-emacs@gnu.org \
--cc=piet@cs.uu.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).