From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: Loading souce Elisp faster Date: Wed, 27 Feb 2013 13:18:16 +0900 Message-ID: <874ngytmnr.fsf@gnu.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1361938705 15772 80.91.229.3 (27 Feb 2013 04:18:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Feb 2013 04:18:25 +0000 (UTC) Cc: lennart.borgman@gmail.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 27 05:18:46 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UAYTe-0007G9-4p for ged-emacs-devel@m.gmane.org; Wed, 27 Feb 2013 05:18:46 +0100 Original-Received: from localhost ([::1]:51210 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAYTJ-0000en-66 for ged-emacs-devel@m.gmane.org; Tue, 26 Feb 2013 23:18:25 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:56604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAYTG-0000ef-3S for emacs-devel@gnu.org; Tue, 26 Feb 2013 23:18:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAYTF-0005zF-00 for emacs-devel@gnu.org; Tue, 26 Feb 2013 23:18:22 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51226) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAYTE-0005zB-RA for emacs-devel@gnu.org; Tue, 26 Feb 2013 23:18:20 -0500 Original-Received: from sit3b311.cs.tsukuba.ac.jp ([130.158.83.177]:32805 helo=mongkok) by fencepost.gnu.org with esmtpa (Exim 4.71) (envelope-from ) id 1UAYTE-0004zl-3s; Tue, 26 Feb 2013 23:18:20 -0500 In-Reply-To: (message from Stefan Monnier on Sun, 24 Feb 2013 22:57:27 -0500) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:157417 Archived-At: In article , Stefan Monnier writes: > > Why not assuming it is utf-8? ;-) > > Unless there is a "-*- coding: ..." comment. > Hmm... that's very appealing, but what about those Elisp files that have > a "coding:" tag at the end of the file? Or are these so rare it's not > worth the trouble to worry about them? Isn't it ok to make it faster to load only such a file that has "-*- coding: utf-8-unix -*-", and document it clearly. The following is just an quick idea. (defun load-source-file-internal (fullname file &optional noerror nomessage) (let (need-decoding) (with-temp-buffer (let ((coding-system-for-read 'no-conversion)) (insert-file-contents fullname nil 0 256) ; or 512, 1024? (or (coding-tag-is-utf-8-unix-p) ; this function must be implemented. (setq need-decoding t)))) (if need-decoding (load-with-code-conversion fullname file noerror nomessage) (load fullname noerror nomessage nil nil t ; new optional argument to tell Fopen to load ; this file without through code-conversion. )))) (setq load-source-file-function 'load-source-file-internal) --- Kenichi Handa handa@gnu.org