From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Katsumi Yamaoka <yamaoka@jpl.org>
Cc: Kenichi Handa <handa@ni.aist.go.jp>, ding@gnus.org, emacs-devel@gnu.org
Subject: Re: [Unicode-2] `read' always returns multibyte symbol
Date: Thu, 15 Nov 2007 21:51:16 -0500 [thread overview]
Message-ID: <jwvabperka0.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <b4moddvt22x.fsf@jpl.org> (Katsumi Yamaoka's message of "Fri, 16 Nov 2007 10:24:06 +0900")
> I see. In relation to this, I've been wanting to exterminate
> the `mm-with-unibyte-current-buffer' macro that Gnus uses here
> and there (if you have time, please look at how it is evil, in
> mm-util.el).
Yes, I spotted it a while ago already (I'm using a few local hacks to
try and catch some multi/unibyte abuses so I tend to bump into bugs
a bit earlier than in normal use).
I think a mistake of Emacs's handling of encoding issues is that we use
"unibyte" and "multibyte" rather than "byteS" and chars".
Stefan
PS: Here are some hunks from my local changes.
@@ -1034,16 +1068,18 @@
(defmacro mm-with-unibyte-buffer (&rest forms)
"Create a temporary buffer, and evaluate FORMS there like `progn'.
Use unibyte mode for this."
- `(let (default-enable-multibyte-characters)
- (with-temp-buffer ,@forms)))
+ `(with-temp-buffer
+ (mm-disable-multibyte)
+ ,@forms))
(put 'mm-with-unibyte-buffer 'lisp-indent-function 0)
(put 'mm-with-unibyte-buffer 'edebug-form-spec '(body))
(defmacro mm-with-multibyte-buffer (&rest forms)
"Create a temporary buffer, and evaluate FORMS there like `progn'.
Use multibyte mode for this."
- `(let ((default-enable-multibyte-characters t))
- (with-temp-buffer ,@forms)))
+ `(with-temp-buffer
+ (mm-enable-multibyte)
+ ,@forms))
(put 'mm-with-multibyte-buffer 'lisp-indent-function 0)
(put 'mm-with-multibyte-buffer 'edebug-form-spec '(body))
@@ -1058,24 +1094,29 @@
harmful since it is likely to modify existing data in the buffer.
For instance, it converts \"\\300\\255\" into \"\\255\" in
Emacs 23 (unicode)."
- (let ((multibyte (make-symbol "multibyte"))
- (buffer (make-symbol "buffer")))
- `(if mm-emacs-mule
- (let ((,multibyte enable-multibyte-characters)
- (,buffer (current-buffer)))
- (unwind-protect
- (let (default-enable-multibyte-characters)
- (set-buffer-multibyte nil)
- ,@forms)
- (set-buffer ,buffer)
- (set-buffer-multibyte ,multibyte)))
- (let (default-enable-multibyte-characters)
- ,@forms))))
+ (message "Braindeadly defined macro: mm-with-unibyte-current-buffer")
+ ;; (let ((multibyte (make-symbol "multibyte"))
+ ;; (buffer (make-symbol "buffer")))
+ ;; `(if mm-emacs-mule
+ ;; (let ((,multibyte enable-multibyte-characters)
+ ;; (,buffer (current-buffer)))
+ ;; (unwind-protect
+ ;; (let (default-enable-multibyte-characters)
+ ;; (set-buffer-multibyte nil)
+ ;; ,@forms)
+ ;; (set-buffer ,buffer)
+ ;; (set-buffer-multibyte ,multibyte)))
+ ;; (let (default-enable-multibyte-characters)
+ ;; ,@forms)))
+ `(progn (assert (not enable-multibyte-characters))
+ ,@forms)
+ )
(put 'mm-with-unibyte-current-buffer 'lisp-indent-function 0)
(put 'mm-with-unibyte-current-buffer 'edebug-form-spec '(body))
(defmacro mm-with-unibyte (&rest forms)
"Eval the FORMS with the default value of `enable-multibyte-characters' nil."
+ (message "Braindead macro: mm-with-unibyte")
`(let (default-enable-multibyte-characters)
,@forms))
(put 'mm-with-unibyte 'lisp-indent-function 0)
@@ -1083,6 +1124,7 @@
(defmacro mm-with-multibyte (&rest forms)
"Eval the FORMS with the default value of `enable-multibyte-characters' t."
+ (message "Braindead macro: mm-with-multibyte")
`(let ((default-enable-multibyte-characters t))
,@forms))
(put 'mm-with-multibyte 'lisp-indent-function 0)
next prev parent reply other threads:[~2007-11-16 2:51 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-13 9:41 [Unicode-2] `read' always returns multibyte symbol Katsumi Yamaoka
2007-11-13 12:55 ` Kenichi Handa
2007-11-13 15:10 ` Stefan Monnier
2007-11-14 4:53 ` Kenichi Handa
2007-11-14 7:06 ` [Unicode-2] `C-h f' error (was Re: `read' always returns multibyte symbol) Katsumi Yamaoka
2007-11-14 13:01 ` Kenichi Handa
2007-11-15 2:06 ` [Unicode-2] `C-h f' error Katsumi Yamaoka
2007-11-19 8:31 ` Katsumi Yamaoka
2007-11-20 11:09 ` CHENG Gao
2007-11-21 10:55 ` Katsumi Yamaoka
2007-11-21 12:14 ` Kenichi Handa
2007-11-21 12:28 ` Katsumi Yamaoka
2007-11-22 2:27 ` Richard Stallman
2007-11-22 4:51 ` Kenichi Handa
2007-11-22 16:22 ` Richard Stallman
2007-11-23 15:20 ` Johan Bockgård
2007-11-25 12:35 ` Kenichi Handa
2007-12-02 21:27 ` Richard Stallman
2007-12-05 5:11 ` Kenichi Handa
2007-12-05 11:26 ` Katsumi Yamaoka
2007-11-25 12:39 ` Kenichi Handa
2007-11-14 3:56 ` [Unicode-2] `read' always returns multibyte symbol Katsumi Yamaoka
2007-11-14 11:39 ` Katsumi Yamaoka
2007-11-14 14:52 ` Stefan Monnier
2007-11-14 23:52 ` Katsumi Yamaoka
2007-11-15 1:15 ` Stefan Monnier
2007-11-15 3:01 ` Katsumi Yamaoka
2007-11-15 3:39 ` Stefan Monnier
2007-11-15 10:20 ` Katsumi Yamaoka
2007-11-15 11:08 ` Kenichi Handa
2007-11-15 11:41 ` Katsumi Yamaoka
2007-11-15 14:41 ` Kenichi Handa
2007-11-15 23:31 ` Katsumi Yamaoka
2007-11-16 0:51 ` Kenichi Handa
2007-11-16 1:24 ` Katsumi Yamaoka
2007-11-16 2:51 ` Stefan Monnier [this message]
2007-11-15 15:22 ` Stefan Monnier
2007-11-16 0:29 ` Kenichi Handa
2007-11-16 10:50 ` Eli Zaretskii
2007-11-13 15:07 ` Stefan Monnier
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=jwvabperka0.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=ding@gnus.org \
--cc=emacs-devel@gnu.org \
--cc=handa@ni.aist.go.jp \
--cc=yamaoka@jpl.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.