unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Seiji Zenitani <zenitani@gmail.com>
To: emacs-devel@gnu.org
Subject: Fwd: Line endings bug
Date: Wed, 16 May 2007 21:01:25 -0400	[thread overview]
Message-ID: <1A5E6FE4-A404-4B1C-BC2E-1B4A76104DDD@gmail.com> (raw)
In-Reply-To: BAY102-F1D85DF07A8ED66C825F69AC3C0@phx.gbl

Hi,

I received the following fix to the mac port.  Although I have not  
yet met troubles regarding CR/LF, I think it makes sense to modify  
utf-16be/16le-mac to utf-16be/16le in the last two lines in mac- 
string-to-utxt, term/mac-win.el.  The default eol character seems to  
be 'unix and I hear OS X's internal code is utf-16 + LF (unix).   
Could you please examine it?

==
Seiji Zenitani
zenitani@gmail.com


Begin forwarded message:
>
> The function mac-string-to-utxt (inside term/mac-win.el) is used to  
> encode text which is then placed onto the system clipboard, It  
> currently uses the encodings utf-16be-mac and/or utf-16le-mac which  
> replace all \n characters with \r (0x0A with 0x0D), You can add the  
> following to .emacs to fix this and preserve the correct newlines  
> in the buffer/file:
>
> (defun mac-string-to-utxt (string &optional coding-system)
>  (or coding-system (setq coding-system mac-system-coding-system))
>  (let (data encoding)
>    (when (and (fboundp 'mac-code-convert-string)
>               (memq (coding-system-base coding-system)
>                     (find-coding-systems-string string)))
>      (setq coding-system
>            (coding-system-change-eol-conversion coding-system 'unix))
>      (let ((str string))
>        (when (and (eq system-type 'darwin)
>                   (eq coding-system 'japanese-shift-jis-mac))
>          (setq encoding mac-text-encoding-mac-japanese-basic-variant)
>          (setq str (subst-char-in-string ?\\ ?\x80 str))
>          (subst-char-in-string ?\\ ?\x5c str t)
>          ;; ASCII-only?
>          (if (string-match "\\`[\x00-\x7f]*\\'" str)
>              (setq str nil)))
>        (and str
>             (setq data (mac-code-convert-string
>                         (encode-coding-string str coding-system)
>                         (or encoding coding-system) nil)))))
>    (or data (encode-coding-string string (if (eq (byteorder) ?B)
>                                              'utf-16be
>                                            'utf-16le)))))
>
> The only change is in the last two lines, removal of -mac in each.

       reply	other threads:[~2007-05-17  1:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BAY102-F1D85DF07A8ED66C825F69AC3C0@phx.gbl>
2007-05-17  1:01 ` Seiji Zenitani [this message]
2007-05-17  2:54   ` Fwd: Line endings bug YAMAMOTO Mitsuharu
2007-05-22  2:34     ` Seiji Zenitani
2007-05-22  3:29       ` YAMAMOTO Mitsuharu

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=1A5E6FE4-A404-4B1C-BC2E-1B4A76104DDD@gmail.com \
    --to=zenitani@gmail.com \
    --cc=emacs-devel@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 public inbox

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

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).