From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: search files with conversion but fundamental mode, no handlers, no file-local vars Date: Thu, 20 Dec 2012 10:57:19 -0800 Message-ID: <3D2A507FA3EE44909DF7CA025897BFC3@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1356029853 13098 80.91.229.3 (20 Dec 2012 18:57:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Dec 2012 18:57:33 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 20 19:57:48 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 1TllJO-0001Q0-0n for ged-emacs-devel@m.gmane.org; Thu, 20 Dec 2012 19:57:42 +0100 Original-Received: from localhost ([::1]:33283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TllJA-0003Kg-Dh for ged-emacs-devel@m.gmane.org; Thu, 20 Dec 2012 13:57:28 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:39246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TllJ6-0003KP-Kv for emacs-devel@gnu.org; Thu, 20 Dec 2012 13:57:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TllJ4-0004ov-Hy for emacs-devel@gnu.org; Thu, 20 Dec 2012 13:57:24 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:46007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TllJ4-0004oq-Av for emacs-devel@gnu.org; Thu, 20 Dec 2012 13:57:22 -0500 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id qBKIvKNZ024739 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 20 Dec 2012 18:57:21 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id qBKIvKd4012934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 20 Dec 2012 18:57:20 GMT Original-Received: from abhmt101.oracle.com (abhmt101.oracle.com [141.146.116.53]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id qBKIvKYG024321 for ; Thu, 20 Dec 2012 12:57:20 -0600 Original-Received: from dradamslap1 (/130.35.178.8) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 20 Dec 2012 10:57:19 -0800 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Ac3e49XdJJRUrEmcQRqCqVpedDVOiw== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 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:155692 Archived-At: Suppose I want to check a set of files for one or more occurrences of a given string. I want the files to be code-converted, but not put in any mode other than fundamental mode, not fontified, not handled by a file handler, and not using any file-local variables. Just a simple search of the file text (after code conversion). I thought there would be a simple, straightforward way to do this, but I didn't find it. A RAW-FILE arg to `find-file-noselect' is out, for instance, since that bypasses code conversion. I tried a few things and finally ended up using `find-buffer-visiting' or `create-file-buffer', followed by `with-current-buffer' with a call to `mm-insert-file-contents'. That seems to work, but is there a simpler approach? Am I missing something obvious? I finally found `mm-insert-file-contents' because I was little-by-little ending up with code that looked like what it in fact does. It seems to turn off quite a lot of (unrelated?) things individually, just to get a simple file read-in plus code conversion. Is there some other function or macro that acts similarly and that is normally used for the kind of thing described? I'm kind of wondering why there is not some parameter combination for `find-file-noselect' that does the job. The available choices seem to be completely raw or completely cooked. I would think that just checking the content of files, with code conversion but without also enabling hooks, handlers, modes, file-local variables..., would be something not too uncommon. And if `mm-insert-file-contents' is indeed the right approach, it seems a bit odd that this functionality should be buried in a file that is specific to a particular area ("utility functions for Mule and low level things") rather than being in, say, `files.el'. Anyway, please let me know if there is something better than `mm-insert-file-contents' for this. Thx.