[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: search files with conversion but fundamental mode, no handlers, no f

From: Drew Adams
Subject: RE: search files with conversion but fundamental mode, no handlers, no file-local vars
Date: Thu, 20 Dec 2012 14:01:05 -0800

> 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?

As I said, I don't have the source code for `insert-file-contents', so I don't
know what it does.  Why does `mm-i-f-c' redefine `default-value' locally?

If `auto-mode-alist' is not used by `i-f-c', and file-local variables are not
used, then how would a mode other than fundamental be used by it?

I was gathering, from the `mm-i-f-c' code and doc, that `i-f-c' did _not_
protect these things.  And unfortunately the doc for `i-f-c' says nothing about
any of these things specifically - unlike the doc of `mm-i-f-c'.  Who knows what
`i-f-c' does or does not do, and how it is really different from `mm-i-f-c'?

> >          (enable-local-variables nil)
> insert-file-contents does not evaluate file-local variables, AFAIK.

So why does `mm-i-f-c' make sure to bind it to ()?

> >          (after-insert-file-functions nil)
> This decodes the file, which you do want.

What is "this"?  `after-insert-file-functions'?  Or binding that to ()?  If the
latter, then I guess I need such a binding.

The doc for `mm-i-f-c' says that it does code conversion, which I understood to
include decoding.  Doesn't that mean that this is not done via
`after-insert-file-functions', since that is bound to ()?

> >          (enable-local-eval nil)
> See above.

What/where?  What does `i-f-c' do wrt `enable-local-eval'?

> >          (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?

What is the bug?  Are you saying that `mm-i-f-c' should not include such a

In my case, I do not really want remote file handlers to kick in.

What does `i-f-c' do wrt remote files?  For a workhorse function, its doc seems
quite paltry.  About the only thing it is specific about is code conversion.

> >          (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.


It's still not at all clear to me which I should use, I'm afraid.  Starting with
the obvious question: Why, if `i-f-c' does all of what you say, are those
bindings needed in `mm-i-f-c'?  And why does the `mm-i-f-c' doc make a point of
saying that it acts differently in regard to these particular things than does
`i-f-c'?  You seem to be saying that they act the same (?).

Let me be clear: I am not arguing about what the case is or isn't - I'm not
arguing at all.  I'm just asking, to learn, and (still) wondering what I should

reply via email to

[Prev in Thread] Current Thread [Next in Thread]