all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <emacs-devel@gnu.org>
Subject: search files with conversion but fundamental mode, no handlers, no file-local vars
Date: Thu, 20 Dec 2012 10:57:19 -0800	[thread overview]
Message-ID: <3D2A507FA3EE44909DF7CA025897BFC3@us.oracle.com> (raw)

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.




             reply	other threads:[~2012-12-20 18:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-20 18:57 Drew Adams [this message]
2012-12-20 19:04 ` search files with conversion but fundamental mode, no handlers, no file-local vars Eli Zaretskii
2012-12-20 19:42   ` Drew Adams
2012-12-20 21:35     ` Eli Zaretskii
2012-12-20 22:01       ` Drew Adams
2012-12-21  8:51         ` Eli Zaretskii
2012-12-20 21:42     ` Stefan Monnier
2012-12-20 22:01       ` Drew Adams
2012-12-20 22:22         ` Stefan Monnier
2012-12-20 22:47           ` Drew Adams
2012-12-21  3:47             ` Stefan Monnier
2012-12-21  4:02               ` Drew Adams
2012-12-21  4:52                 ` Stefan Monnier
2012-12-21 11:53                 ` Eli Zaretskii
2012-12-21 16:13                   ` Drew Adams
2012-12-21  8:54             ` Eli Zaretskii
2012-12-21 14:44               ` Stefan Monnier
2012-12-21 15:09                 ` Eli Zaretskii
2012-12-22 16:00                   ` Stefan Monnier
2012-12-21 16:12                 ` Drew Adams
2012-12-21  8:39         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D2A507FA3EE44909DF7CA025897BFC3@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.