help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: "Text is read-only"... except it isn't... or shouldn't be


From: ken
Subject: Re: "Text is read-only"... except it isn't... or shouldn't be
Date: Wed, 15 May 2013 07:48:19 -0400
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130402 Thunderbird/17.0.5

On 05/15/2013 01:17 AM Kevin Rodgers wrote:
On 5/14/13 2:39 PM, ken wrote:
On 05/14/2013 09:39 AM Eli Zaretskii wrote:
Date: Tue, 14 May 2013 08:22:00 -0400
From: ken <gebser@mousecar.com>
CC: Eli Zaretskii <eliz@gnu.org>, help-gnu-emacs@gnu.org

[...] overly simplistic strategy for determining a file type merely
by looking at the filename extension, especially when this can be
more suitably and accurately and intelligently accomplished by
determining a file's magic number as the Linux "file" utility does.

Emacs does look at the magic signature, see magic-mode-alist.


They why didn't it see that my file was (obviously) a text file and
not an image
file?

1. Because the default value of magic-mode-alist is nil.

If you mean this functionality was turned off in this version I recently installed, then, yes, that agrees with what I said earlier in this thread: emacs no longer determines a file's magic upon visiting a file. The more comprehensive fix, then, would be to set magic-mode-alist to t, yes? If so, what elisp statement(s) do you think would best accomplish that?



2. Because the default value of auto-mode-alist matches the ".gif"
extension.

The documentation suggests that magic-mode-alist, if turned on, will override auto-mode-alist.



3. Because it is not obvious what the signature is for a text file --
perhaps
    something like "\\`[[:print:]\t\f\r\n]", which is so general that it
would
    prevent most of the existing automatic method from working.

Yes, the damned humans with their writing so random and the different languages characters and syntaxes and punctuation etc. make such evaluation nigh impossible. Probably for this reason, magic mode adopts a different strategy. The linux "file" utility, referred to earlier in this thread, probably does this also, as it makes fairly reliable evaluations of files' contents.




reply via email to

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