From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Large-file check in files.el Date: Tue, 01 Apr 2008 11:56:25 -0400 Message-ID: References: <55f7df060803312155wdfe27c0w5bbbaac1562285a4@mail.gmail.com> <55f7df060804010502j689f88c4k8888030298f3d065@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1207065582 22530 80.91.229.12 (1 Apr 2008 15:59:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Apr 2008 15:59:42 +0000 (UTC) Cc: emacs- devel To: "Adrian Robert" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 01 18:00:14 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JgirJ-0006BK-Ih for ged-emacs-devel@m.gmane.org; Tue, 01 Apr 2008 17:57:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jgiqh-0007q1-Br for ged-emacs-devel@m.gmane.org; Tue, 01 Apr 2008 11:56:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jgiqc-0007n2-Rc for emacs-devel@gnu.org; Tue, 01 Apr 2008 11:56:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jgiqb-0007hx-3G for emacs-devel@gnu.org; Tue, 01 Apr 2008 11:56:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jgiqa-0007hb-U0 for emacs-devel@gnu.org; Tue, 01 Apr 2008 11:56:28 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jgiqa-0005f8-IW for emacs-devel@gnu.org; Tue, 01 Apr 2008 11:56:28 -0400 Original-Received: from ceviche.home (vpn-132-204-232-167.acd.umontreal.ca [132.204.232.167]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id m31FudoT003435 for ; Tue, 1 Apr 2008 11:56:39 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id A85ACB40F9; Tue, 1 Apr 2008 11:56:25 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-NAI-Spam-Score: -2.5 X-NAI-Spam-Rules: 1 Rules triggered BAYES_00=-2.5 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:94124 Archived-At: > =================================================================== > RCS file: /cvsroot/emacs/emacs/lisp/files.el,v > retrieving revision 1.966 > diff -c -b -r1.966 files.el > *** files.el 14 Mar 2008 17:14:09 -0000 1.966 > --- files.el 1 Apr 2008 12:00:30 -0000 > *************** > *** 1507,1512 **** > --- 1507,1523 ---- > :version "22.1" > :type '(choice integer (const :tag "Never request confirmation" nil))) > + (defun should-abort-large-file (attributes opType &optional buf nowarn) > + "Utility function: return t if file is larger than > large-file-warning-threshold > + and user declines loading it. If buf or nowarn are true, always return nil." > + (if (and large-file-warning-threshold (nth 7 attributes) (not (or > buf nowarn))) > + (and (> (nth 7 attributes) large-file-warning-threshold) > + (not (y-or-n-p > + (format "File %s is large (%dMB), really %s? " > + (file-name-nondirectory filename) > + (/ (nth 7 attributes) 1048576) opType)))) > + nil)) I'd call it "warn-about-large-file" or something like that and would let it do the (error "Aborted!"). Please try C-u M-x checkdoc-current-buffer RET Don't take its recommendations are gospel (even it tends to want to force it upon you), but they're often useful for people to learn about conventions, e.g. the first line of a docstring should be self-contained, and arguments should appear in upper-case. Also in Elisp, we tend to use "op-type" rather than "opType". Finally "buf" shouldn't be an argument (only "nowarn" is needed). Stefan