From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: default large-file-warning-threshold Date: Tue, 02 Dec 2014 06:15:12 +0100 Message-ID: References: <21606.10799.112099.788101@a1i15.kph.uni-mainz.de> <1753218.Ot8JCqssfN@descartes> <546AABCF.8030705@cs.ucla.edu> <9xioico2nm.fsf@fencepost.gnu.org> <83k32s9zm5.fsf@gnu.org> <547A4A1B.9060807@cs.ucla.edu> <20141130101201.3a2625e6@forcix> <547B4285.8070901@cs.ucla.edu> <83wq6c8s47.fsf@gnu.org> <547B9127.2080508@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1417497355 19857 80.91.229.3 (2 Dec 2014 05:15:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Dec 2014 05:15:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 02 06:15:49 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XvfoS-0000Bd-Ug for ged-emacs-devel@m.gmane.org; Tue, 02 Dec 2014 06:15:49 +0100 Original-Received: from localhost ([::1]:35137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvfoS-0000ZQ-HO for ged-emacs-devel@m.gmane.org; Tue, 02 Dec 2014 00:15:48 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvfoK-0000ZD-3E for emacs-devel@gnu.org; Tue, 02 Dec 2014 00:15:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XvfoB-0001TA-MN for emacs-devel@gnu.org; Tue, 02 Dec 2014 00:15:40 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:49685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvfoB-0001T3-E2 for emacs-devel@gnu.org; Tue, 02 Dec 2014 00:15:31 -0500 Original-Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Xvfns-0001ZB-Rf; Tue, 02 Dec 2014 06:15:12 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAD1BMVEWRhoFiWFUFBAkiHiHT zsujC6nfAAACQElEQVQ4jU3T67mDIAwG4IAZACQDKDoAtwGCZP+ZTqjanv7q49svJJFCrSXakaSJ jE1Y0I44P3BD5iY8DhYha+bzY8Jhx86EfEWFZuEGr4mogC9cdJeacIy9I+EVQaG3GxYtVa99YJNR kYT4gTBLXVvXtoZXdbytPxipyyndUEPH9frCMdJQGJ4IjdTxtLsq5KGluifEIbXfAx5PgqRnwj4k fAaBMnM3jJwmLHQn4kycs9RybDAGmvOBGPdrAtq499FpnOWbuJoCWY12bmNb9VyIn3abPmg2VmZK fbcv7EvTJ63kpLsyfMwJIR4/cAHpXCSOeCjEGzqRTwsRjQnPHFtQwMbYEWFgMZ9SE+rJjA2wE/RO 1r9wFj1S3wV4t2h7l/tCbIsC9Owu3f+gH6BnZh9qvgDz5x1+ujqjS9A51FqHoyCtPIkUndPIBKC2 UrYPtAjs/QNkab1eKNC9k6ygvY22fhM6gcEbXPetLO+AwsY7TLVmB+DcF3ZmnU38OFJj57j4B/Rq gtHLAB4Se+BAL5CIqSVlXHxiFoMvoAjYcDjsS9WLLfyCfqdgSpJu8/zR+AGjNyELV6cg6wMHg4Je Y+zHB8p7EwGAHZgqSwb9V/Gb2BGQkwFPQSfEH2gCIRtxuXqnA/G7q421VmbUq+8BiLn8h8QObfVo dF3/E65qvVVhcfA94zQ+pFXbKtmj/QcNcs5WX2/RVa06yQu6wRxCckvJBGvWujfo4DXbkEwoGWH1 tT6w6zL8quBLZle8ThnjH71loyIPWJSyAAAAAElFTkSuQmCC X-Now-Playing: Peter Gabriel's _Peter Gabriel 2_: "On The Air" X-Hashcash: 1:23:141202:emacs-devel@gnu.org::wgAr4UKqRkwIqKzV:000000000000000000000000000000000000000000DFeP X-Hashcash: 1:23:141202:eliz@gnu.org::ZcyBdWCiaruBj5/B:00000SkYB X-Hashcash: 1:23:141202:eggert@cs.ucla.edu::7b+pZswEd2eMZyi4:0000000000000000000000000000000000000000001NN6M In-Reply-To: <547B9127.2080508@cs.ucla.edu> (Paul Eggert's message of "Sun, 30 Nov 2014 13:50:31 -0800") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-MailScanner-ID: 1Xvfns-0001ZB-Rf MailScanner-NULL-Check: 1418102113.37049@kg/m3bVa2ZWjh6Y29UMv+A X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:178674 Archived-At: Paul Eggert 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 `large-file-mode'. 3) Files smaller than this are handled like now. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no