X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fbytecomp.el;h=df749631a1b0dce09bb1350b1820c985bdf30ebc;hb=f86390529d8ff5a626ee64d9c30f53ffcbfdc6c9;hp=0122e2692083fef49cb48220fef82c737738c652;hpb=5b4300d510f709310a2dc88b55316082a4188f8a;p=chise%2Fxemacs-chise.git- diff --git a/lisp/bytecomp.el b/lisp/bytecomp.el index 0122e26..df74963 100644 --- a/lisp/bytecomp.el +++ b/lisp/bytecomp.el @@ -1751,33 +1751,69 @@ With argument, insert value in current buffer after the form." ;; Emacsen. (when (featurep 'mule) (defvar buffer-file-coding-system) - (if (save-excursion - (set-buffer byte-compile-inbuffer) + (let (ces) + (save-excursion + (set-buffer byte-compile-inbuffer) + (goto-char (point-min)) + ;; mrb- There must be a better way than skip-chars-forward + (skip-chars-forward (concat (char-to-string 0) "-" + (char-to-string 255))) + (if (eq (point) (point-max)) + (setq ces 'raw-text) + (goto-char (point-min)) + (while (< (point)(point-max)) + (cond ((eq (char-after) ?\;) + (delete-region (point)(point-at-eol)) + (if (eq (char-after) ?\n) + (delete-char 1) + (forward-char)) + ) + ((eq (char-after) ?\?) + (forward-char 2) + ) + ((eq (char-after) ?\n) + (forward-char) + ) + ((eq (char-after) ?\") + (forward-char) + (while (and (< (point)(point-max)) + (not (when (eq (char-after) ?\") + (forward-char) + t))) + (if (eq (char-after) ?\\) + (forward-char 2) + (forward-char))) + ) + (t + (forward-char)))) (goto-char (point-min)) - ;; mrb- There must be a better way than skip-chars-forward (skip-chars-forward (concat (char-to-string 0) "-" (char-to-string 255))) - (and (eq (point) (point-max)) - (not - (re-search-backward - "\\u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]" nil t)))) - (setq buffer-file-coding-system 'raw-text) - (cond ((featurep 'utf-2000) - (insert "(require 'mule)\n;;;###coding system: utf-8\n") - (setq buffer-file-coding-system 'utf-8) - ) - (t - (insert "(require 'mule)\n;;;###coding system: escape-quoted\n") - (setq buffer-file-coding-system 'escape-quoted) - )) - ;; #### Lazy loading not yet implemented for MULE files - ;; mrb - Fix this someday. - (save-excursion - (set-buffer byte-compile-inbuffer) - (setq byte-compile-dynamic nil - byte-compile-dynamic-docstrings nil)) - ;;(external-debugging-output (prin1-to-string (buffer-local-variables)))) - )) + (setq ces + (if (eq (point) (point-max)) + (if (and (featurep 'utf-2000) + (re-search-backward "\\\\u[0-9A-Fa-f]+" nil t)) + 'utf-8-unix + 'raw-text))))) + (if (eq ces 'raw-text) + (setq buffer-file-coding-system 'raw-text) + (cond ((eq ces 'utf-8-unix) + (insert "(require 'mule)\n;;;###coding system: utf-8-unix\n") + (setq buffer-file-coding-system 'utf-8-unix) + ) + (t + (insert "(require 'mule)\n;;;###coding system: escape-quoted\n") + (setq buffer-file-coding-system 'escape-quoted) + )) + ;; #### Lazy loading not yet implemented for MULE files + ;; mrb - Fix this someday. + (save-excursion + (set-buffer byte-compile-inbuffer) + (setq byte-compile-dynamic nil + byte-compile-dynamic-docstrings nil)) + ;; (external-debugging-output + ;; (prin1-to-string (buffer-local-variables))) + ))) )