all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nikolaj Schumacher <n_schumacher@web.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: File name completion on Mac OS X with German umlauts
Date: Tue, 18 Mar 2008 19:05:28 +0100	[thread overview]
Message-ID: <m2iqzjgb6f.fsf@nschum.de> (raw)
In-Reply-To: <uod9dgkuo.fsf@gnu.org> (Eli Zaretskii's message of "Mon\, 17 Mar 2008 22\:24\:15 +0200")

Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Nikolaj Schumacher <n_schumacher@web.de>
>>
>> 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




      reply	other threads:[~2008-03-18 18:05 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
2008-03-17 20:24               ` Eli Zaretskii
2008-03-18 18:05                 ` Nikolaj Schumacher [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2iqzjgb6f.fsf@nschum.de \
    --to=n_schumacher@web.de \
    --cc=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.