unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* search files with conversion but fundamental mode, no handlers, no file-local vars
@ 2012-12-20 18:57 Drew Adams
  2012-12-20 19:04 ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Drew Adams @ 2012-12-20 18:57 UTC (permalink / raw)
  To: emacs-devel

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.




^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2012-12-22 16:00 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-20 18:57 search files with conversion but fundamental mode, no handlers, no file-local vars Drew Adams
2012-12-20 19:04 ` 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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).