1 |
;;; mm-util.el --- Utility functions for Mule and low level things |
;;; mm-util.el --- Utility functions for Mule and low level things |
2 |
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 |
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 |
3 |
;; Free Software Foundation, Inc. |
;; Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
611 |
(put 'mm-with-unibyte-buffer 'lisp-indent-function 0) |
(put 'mm-with-unibyte-buffer 'lisp-indent-function 0) |
612 |
(put 'mm-with-unibyte-buffer 'edebug-form-spec '(body)) |
(put 'mm-with-unibyte-buffer 'edebug-form-spec '(body)) |
613 |
|
|
614 |
|
(defmacro mm-with-multibyte-buffer (&rest forms) |
615 |
|
"Create a temporary buffer, and evaluate FORMS there like `progn'. |
616 |
|
Use multibyte mode for this." |
617 |
|
`(let ((default-enable-multibyte-characters t)) |
618 |
|
(with-temp-buffer ,@forms))) |
619 |
|
(put 'mm-with-multibyte-buffer 'lisp-indent-function 0) |
620 |
|
(put 'mm-with-multibyte-buffer 'edebug-form-spec '(body)) |
621 |
|
|
622 |
(defmacro mm-with-unibyte-current-buffer (&rest forms) |
(defmacro mm-with-unibyte-current-buffer (&rest forms) |
623 |
"Evaluate FORMS with current buffer temporarily made unibyte. |
"Evaluate FORMS with current buffer temporarily made unibyte. |
624 |
Also bind `default-enable-multibyte-characters' to nil. |
Also bind `default-enable-multibyte-characters' to nil. |
640 |
(put 'mm-with-unibyte-current-buffer 'edebug-form-spec '(body)) |
(put 'mm-with-unibyte-current-buffer 'edebug-form-spec '(body)) |
641 |
|
|
642 |
(defmacro mm-with-unibyte (&rest forms) |
(defmacro mm-with-unibyte (&rest forms) |
643 |
"Eval the FORMS with the default value of `enable-multibyte-characters' nil, ." |
"Eval the FORMS with the default value of `enable-multibyte-characters' nil." |
644 |
`(let (default-enable-multibyte-characters) |
`(let (default-enable-multibyte-characters) |
645 |
,@forms)) |
,@forms)) |
646 |
(put 'mm-with-unibyte 'lisp-indent-function 0) |
(put 'mm-with-unibyte 'lisp-indent-function 0) |
647 |
(put 'mm-with-unibyte 'edebug-form-spec '(body)) |
(put 'mm-with-unibyte 'edebug-form-spec '(body)) |
648 |
|
|
649 |
|
(defmacro mm-with-multibyte (&rest forms) |
650 |
|
"Eval the FORMS with the default value of `enable-multibyte-characters' t." |
651 |
|
`(let ((default-enable-multibyte-characters t)) |
652 |
|
,@forms)) |
653 |
|
(put 'mm-with-multibyte 'lisp-indent-function 0) |
654 |
|
(put 'mm-with-multibyte 'edebug-form-spec '(body)) |
655 |
|
|
656 |
(defun mm-find-charset-region (b e) |
(defun mm-find-charset-region (b e) |
657 |
"Return a list of Emacs charsets in the region B to E." |
"Return a list of Emacs charsets in the region B to E." |
658 |
(cond |
(cond |