[Top][All Lists]

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

Re: default large-file-warning-threshold

From: Lars Magne Ingebrigtsen
Subject: Re: default large-file-warning-threshold
Date: Tue, 02 Dec 2014 06:15:12 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Paul Eggert <address@hidden> writes:

> Lars Magne Ingebrigtsen wrote:
>> Do we have a way to ask the OS how much (physical-ish) RAM it has?
> We could easily add that, using Gnulib's physmem module.  For example,
> GNU 'sort' uses physmem to calculate an internal buffer size ranging
> from 1/8 to 3/4 of physical memory, depending on some other factors.

Here's a concrete suggestion that I think covers most of the issues
regarding the "look at log files" use case, as well as the security
issues involved with large files with complex modes.

0) We introduce a new, very trivial mode called `large-file-mode' which
is just `fundamental-mode' with one command: `M-m', which switches on
whatever mode would normally have been in that buffer.  The mode says on
startup "Use the command `M-m' to switch `foo-mode' on".

1) We set `large-file-warning-threshold' to 1/8th of the physical
memory.  If the user loads a file bigger than that, she gets queried
just as now, but the buffer is loaded with `find-file-literally' and
ends up in `large-file-mode'.

2) We add a new variable, `large-file-automatic-mode-threshold', which
is (max 40MB (/ large-file-warning-threshold 10)).  All files bigger
than this are loaded with `find-file-literally' and ends up in

3) Files smaller than this are handled like now.

(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

reply via email to

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