From: tomo Date: Sun, 14 Nov 1999 18:49:45 +0000 (+0000) Subject: (byte-compile-insert-header): Delete comments if non-ASCII characters X-Git-Tag: r21-2-19-utf-2000-0_12-0~18 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=4908048098b34687688fa07743f8b9f08cb9bbee;p=chise%2Fxemacs-chise.git- (byte-compile-insert-header): Delete comments if non-ASCII characters are found; allow `byte-compile-dynamic' and `byte-compile-dynamic-docstrings' if *.elc will be encoded by `raw-text'. --- diff --git a/lisp/bytecomp.el b/lisp/bytecomp.el index 68d0fb3..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))) + ))) )