From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nikolaj Schumacher Newsgroups: gmane.emacs.help Subject: Re: File name completion on Mac OS X with German umlauts Date: Tue, 18 Mar 2008 19:05:28 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1205863622 27606 80.91.229.12 (18 Mar 2008 18:07:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Mar 2008 18:07:02 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 18 19:07:28 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JbgCj-0002WW-ST for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Mar 2008 19:06:30 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JbgCA-000683-4K for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Mar 2008 14:05:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JbgBt-00066Y-LB for help-gnu-emacs@gnu.org; Tue, 18 Mar 2008 14:05:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JbgBs-00066D-V8 for help-gnu-emacs@gnu.org; Tue, 18 Mar 2008 14:05:37 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JbgBs-000662-Kd for help-gnu-emacs@gnu.org; Tue, 18 Mar 2008 14:05:36 -0400 Original-Received: from fmmailgate01.web.de ([217.72.192.221]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JbgBn-0004Rc-GC; Tue, 18 Mar 2008 14:05:32 -0400 Original-Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate01.web.de (Postfix) with ESMTP id 7A629D76FDD4; Tue, 18 Mar 2008 19:05:29 +0100 (CET) Original-Received: from [77.135.78.239] (helo=wednesday) by smtp06.web.de with asmtp (WEB.DE 4.109 #226) id 1JbgBl-0005nx-00; Tue, 18 Mar 2008 19:05:29 +0100 In-Reply-To: (Eli Zaretskii's message of "Mon\, 17 Mar 2008 22\:24\:15 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.92 (darwin) X-Sender: n_schumacher@web.de X-Provags-ID: V01U2FsdGVkX1/7re1Yy4A/Zq5v1TMh69jqwPf4VAw1kgmGpQ4r dxgZcNzMbOlj2gwPLWKbWBxGCKHTiHZS5pSpNowGTXciVYgO0D kPb8tBv1w6X0UTqqLZ0g== X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:52498 Archived-At: Eli Zaretskii wrote: >> From: Nikolaj Schumacher >> >> This is very interesting. Apparently `read-file-name' doesn't use >> `file-name-coding-system' when completing. > > How do you see that? Just looking at the sources, I see it does. Sorry, I phrased that poorly. I only intended to express a suspicion... After some actual research, I the real reason appears to be that utf-8m.el only offers one-way transformation and `read-file-name' needs the other direction. A naive attempt of adding that worked surprisingly well. The only issue I have is that Emacs always says "Complete, but not unique". Don't know why, yet. (require 'utf-8m) (defun utf-8m-pre-write-conversion (beg end) (save-excursion ;; conversion (NFC -> NFD) (save-restriction (narrow-to-region beg end) (let ((str (buffer-string))) (delete-region (point-min) (point-max)) (insert (decode-coding-string (or (mac-code-convert-string (encode-coding-string str 'utf-8) 'utf-8 'utf-8 'NFD) "") 'utf-8) )) ))) (make-coding-system 'utf-8m-alt 4 ?U "modified UTF-8 encoding for Mac OS X hfs plus volume format." '(ccl-decode-mule-utf-8 . ccl-encode-mule-utf-8) `((safe-charsets ascii eight-bit-control eight-bit-graphic latin-iso8859-1 mule-unicode-0100-24ff mule-unicode-2500-33ff mule-unicode-e000-ffff ,@(if utf-translate-cjk-mode utf-translate-cjk-charsets)) (mime-charset . nil) (coding-category . coding-category-utf-8) (valid-codes (0 . 255)) (pre-write-conversion . ,(if (fboundp 'mac-code-convert-string) 'utf-8m-pre-write-conversion 'utf-8-pre-write-conversion)) ,(if (functionp 'mac-code-convert-string) '(post-read-conversion . utf-8m-e22-mac-post-read-conversion) '(post-read-conversion . utf-8m-e22-post-read-conversion)) (translation-table-for-encode . utf-translation-table-for-encode) (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode utf-fragment-on-decoding utf-translate-cjk-mode))) (require 'utf-8m-alt) (setq file-name-coding-system 'utf-8m-alt) regards, Nikolaj Schumacher