Mercurial > emacs
view lisp/=medit.el @ 29005:b396df3a5181
(ONE_MORE_BYTE, TWO_MORE_BYTES): Set coding->resutl to
CODING_FINISH_INSUFFICIENT_SRC if there's not enough source.
(ONE_MORE_CHAR, EMIT_CHAR, EMIT_ONE_BYTE, EMIT_TWO_BYTE,
EMIT_BYTES): New macros.
(THREE_MORE_BYTES, DECODE_CHARACTER_ASCII,
DECODE_CHARACTER_DIMENSION1, DECODE_CHARACTER_DIMENSION2): These
macros deleted.
(CHECK_CODE_RANGE_A0_FF): This macro deleted.
(detect_coding_emacs_mule): Use UNIBYTE_STR_AS_MULTIBYTE_P to
check the validity of multibyte sequence.
(decode_coding_emacs_mule): New function.
(encode_coding_emacs_mule): New macro.
(detect_coding_iso2022): Use ONE_MORE_BYTE to fetch a byte from
the source.
(DECODE_ISO_CHARACTER): Just return a character code.
(DECODE_COMPOSITION_START): Set coding->result instead of result.
(decode_coding_iso2022, decode_coding_sjis_big5, decode_eol): Use
EMIT_CHAR to produced decoded characters. Exit the loop only by
macros ONE_MORE_BYTE or EMIT_CHAR. Don't handle the case of last
block here.
(ENCODE_ISO_CHARACTER): Don't translate character here. Produce
only position codes for an invalid character.
(encode_designation_at_bol): Return new destination pointer. 5th
arg DSTP is changed to DST.
(encode_coding_iso2022, decode_coding_sjis_big5): Get a character
from the source by ONE_MORE_CHAR. Don't handle the case of last
block here.
(DECODE_SJIS_BIG5_CHARACTER, ENCODE_SJIS_BIG5_CHARACTER): These
macros deleted.
(detect_coding_sjis, detect_coding_big5, detect_coding_utf_8,
detect_coding_utf_16, detect_coding_ccl): Use ONE_MORE_BYTE and
TWO_MORE_BYTES to fetch a byte from the source.
(encode_eol): Pay attention to coding->src_multibyte.
(detect_coding, detect_eol): Preserve members src_multibyte and
dst_multibyte.
(DECODING_BUFFER_MAG): Return 2 even for coding_type_raw_text.
(encoding_buffer_size): Set magnification to 3 for all coding
systems that require encoding.
(ccl_coding_driver): For decoding, be sure that the result is
valid multibyte sequence.
(decode_coding): Initialize coding->errors and coding->result.
For emacs-mule, call decode_coding_emacs_mule. For no-conversion
and raw-text, always call decode_eol. Handle the case of last
block here. If not coding->dst_multibyte, convert the resulting
sequence to unibyte.
(encode_coding): Initialize coding->errors and coding->result.
For emacs-mule, call encode_coding_emacs_mule. For no-conversion
and raw-text, always call encode_eol. Handle the case of last
block here.
(shrink_decoding_region, shrink_encoding_region): Detect cases
that we can't skip data more rigidly.
(code_convert_region): Setup src_multibyte and dst_multibyte
members of coding. For decoding, if the buffer is multibyte,
convert the source sequence to unibyte in advance. For encoding,
if the buffer is multibyte, convert the resulting sequence to
multibyte afterward.
(run_pre_post_conversion_on_str): New function.
(code_convert_string): Deleted and divided into the following two.
(decode_coding_string, encode_coding_string): New functions.
(code_convert_string1, code_convert_string_norecord): Call one of
above.
(Fdecode_sjis_char, Fdecode_big5_char): Use MAKE_CHAR instead of
MAKE_NON_ASCII_CHAR.
(Fset_terminal_coding_system_internal,
Fset_safe_terminal_coding_system_internal): Setup src_multibyte
and dst_multibyte members.
(init_coding_once): Initialize iso_code_class with new enum
ISO_control_0 and ISO_control_1.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 19 May 2000 23:54:56 +0000 |
parents | d093f6556363 |
children |
line wrap: on
line source
;;; medit.el --- front-end to the MEDIT package for editing MDL ;; Copyright (C) 1985 Free Software Foundation, Inc. ;; Author: K. Shane Hartman ;; Maintainer: FSF ;; Keywords: languages ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ;;; Commentary: ;; >> This package depends on two MDL packages: MEDIT and FORKS which ;; >> can be obtained from the public (network) library at mit-ajax. ;;; Code: (require 'mim-mode) (defconst medit-zap-file (concat "/tmp/" (user-login-name) ".medit.mud") "File name for data sent to MDL by Medit.") (defconst medit-buffer "*MEDIT*" "Name of buffer in which Medit accumulates data to send to MDL.") (defconst medit-save-files t "If non-nil, Medit offers to save files on return to MDL.") (defun medit-save-define () "Mark the previous or surrounding toplevel object to be sent back to MDL." (interactive) (save-excursion (beginning-of-DEFINE) (let ((start (point))) (forward-mim-object 1) (append-to-buffer medit-buffer start (point)) (goto-char start) (message "%s" (buffer-substring start (progn (end-of-line) (point))))))) (defun medit-save-region (start end) "Mark the current region to be sent to back to MDL." (interactive "r") (append-to-buffer medit-buffer start end) (message "Current region saved for MDL.")) (defun medit-save-buffer () "Mark the current buffer to be sent back to MDL." (interactive) (append-to-buffer medit-buffer (point-min) (point-max)) (message "Current buffer saved for MDL.")) (defun medit-zap-define-to-mdl () "Return to MDL with surrounding or previous toplevel MDL object." (interactive) (medit-save-define) (medit-goto-mdl)) (defun medit-zap-region-mdl (start end) "Return to MDL with current region." (interactive) (medit-save-region start end) (medit-goto-mdl)) (defun medit-zap-buffer () "Return to MDL with current buffer." (interactive) (medit-save-buffer) (medit-goto-mdl)) (defun medit-goto-mdl () "Return from Emacs to superior MDL, sending saved code. Optionally, offers to save changed files." (interactive) (let ((buffer (get-buffer medit-buffer))) (if buffer (save-excursion (set-buffer buffer) (if (buffer-modified-p buffer) (write-region (point-min) (point-max) medit-zap-file)) (set-buffer-modified-p nil) (erase-buffer))) (if medit-save-files (save-some-buffers)) ;; Note could handle parallel fork by giving argument "%xmdl". Then ;; mdl would have to invoke with "%emacs". (suspend-emacs))) (defconst medit-mode-map nil) (if (not medit-mode-map) (progn (setq medit-mode-map (copy-keymap mim-mode-map)) (define-key medit-mode-map "\e\z" 'medit-save-define) (define-key medit-mode-map "\e\^z" 'medit-save-buffer) (define-key medit-mode-map "\^xz" 'medit-goto-mdl) (define-key medit-mode-map "\^xs" 'medit-zap-buffer))) (defconst medit-mode-hook (and (boundp 'mim-mode-hook) mim-mode-hook) "") (setq mim-mode-hook '(lambda () (medit-mode))) (defun medit-mode (&optional state) "Major mode for editing text and returning it to a superior MDL. Like Mim mode, plus these special commands: \\{medit-mode-map}" (interactive) (use-local-map medit-mode-map) (run-hooks 'medit-mode-hook) (setq major-mode 'medit-mode) (setq mode-name "Medit")) (mim-mode) ;;; medit.el ends here