From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: search files with conversion but fundamental mode, no handlers, no file-local vars Date: Thu, 20 Dec 2012 23:35:24 +0200 Message-ID: <83sj70mmoz.fsf@gnu.org> References: <3D2A507FA3EE44909DF7CA025897BFC3@us.oracle.com> <83txrgmtof.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1356039347 2777 80.91.229.3 (20 Dec 2012 21:35:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Dec 2012 21:35:47 +0000 (UTC) Cc: emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 20 22:36:00 2012 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 1TlnmS-0007GD-Qq for ged-emacs-devel@m.gmane.org; Thu, 20 Dec 2012 22:35:52 +0100 Original-Received: from localhost ([::1]:37015 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlnmF-0007oK-6N for ged-emacs-devel@m.gmane.org; Thu, 20 Dec 2012 16:35:39 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tlnm8-0007nN-Av for emacs-devel@gnu.org; Thu, 20 Dec 2012 16:35:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tlnm4-0007KK-4W for emacs-devel@gnu.org; Thu, 20 Dec 2012 16:35:32 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:38875) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tlnm3-0007Ju-T2 for emacs-devel@gnu.org; Thu, 20 Dec 2012 16:35:28 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MFC00600MFLSO00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Thu, 20 Dec 2012 23:35:26 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MFC006J8MN1J390@a-mtaout22.012.net.il>; Thu, 20 Dec 2012 23:35:26 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.172 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:155699 Archived-At: > From: "Drew Adams" > Cc: > Date: Thu, 20 Dec 2012 11:42:55 -0800 > > > What's wrong with insert-file-contents? > > I'm not sure, now that I try it again! Thanks for asking. I think insert-file-contents _is_ the proper way of doing what you want. You can see many examples of its usage in Emacs Lisp packages bundled with Emacs. > I don't have the C code defining `insert-file-contents', to compare. but that > doc string does seem to suggest that, _unlike_ `insert-file-contents', it > inhibits the use of "`file-name-handlers,..., `find-file-hooks', etc." I do not > need/want handlers, hooks, etc. to kick in here. FWIW, I think most, if not all, things inhibited by mm-insert-file-contents are either not needed or incorrect. > (letf* ((format-alist nil) > (auto-mode-alist (if inhibit nil (mm-auto-mode-alist))) auto-mode-alist is not consulted by insert-file-contents, AFAIK. > ((default-value 'major-mode) 'fundamental-mode) Why? to protect from someone who overrides the default? > (enable-local-variables nil) insert-file-contents does not evaluate file-local variables, AFAIK. > (after-insert-file-functions nil) This decodes the file, which you do want. > (enable-local-eval nil) See above. > (inhibit-file-name-operation (if inhibit > 'insert-file-contents > inhibit-file-name-operation)) > (inhibit-file-name-handlers > (if inhibit > (append mm-inhibit-file-name-handlers > inhibit-file-name-handlers) > inhibit-file-name-handlers)) This is a bug, IMO, at least in the general case: why should any code like what you wanted to write be prevented from working on remote files? > (ffh (if (boundp 'find-file-hook) > 'find-file-hook > 'find-file-hooks)) > (val (symbol-value ffh))) > (set ffh nil) I don't think find-file-hook/hooks is relevant, as you don't invoke find-file here.