From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Adrian Robert" Newsgroups: gmane.emacs.devel Subject: Large-file check in files.el Date: Tue, 1 Apr 2008 07:55:59 +0300 Message-ID: <55f7df060803312155wdfe27c0w5bbbaac1562285a4@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1207025777 14223 80.91.229.12 (1 Apr 2008 04:56:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Apr 2008 04:56:17 +0000 (UTC) To: "emacs- devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 01 06:56:49 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 1JgYYD-0005z7-28 for ged-emacs-devel@m.gmane.org; Tue, 01 Apr 2008 06:56:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JgYXb-00079f-39 for ged-emacs-devel@m.gmane.org; Tue, 01 Apr 2008 00:56:11 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JgYXV-00079M-CE for emacs-devel@gnu.org; Tue, 01 Apr 2008 00:56:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JgYXS-000792-En for emacs-devel@gnu.org; Tue, 01 Apr 2008 00:56:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JgYXS-00078z-BJ for emacs-devel@gnu.org; Tue, 01 Apr 2008 00:56:02 -0400 Original-Received: from rv-out-0910.google.com ([209.85.198.186]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JgYXR-0000qS-SM for emacs-devel@gnu.org; Tue, 01 Apr 2008 00:56:02 -0400 Original-Received: by rv-out-0910.google.com with SMTP id c27so2098907rvf.6 for ; Mon, 31 Mar 2008 21:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=JNqQX3M+aGEig/jERzoumV2KVsGXWa/UdWuEmsUS/G0=; b=WL+OShmfLrXxXUWoU4rISHnW1Uv0/OBKPstHRhjjTrYp6x6DqOGE+IWqthgJReO4Jsq3AgdXpbyC/uydfy/b2XGdCJP2FUEq6SzUDXbkf0N8L00w6xyf7fr3d2tCUym+iyY6HVlgm/J0ui8gSAZfgaSvpj9Q/1veh786ZMgf4WA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=GKvExIKXm8OS1CRSxvhB83VCtVdl7sRsR/sm5lpLpMdRwO7XnW5if74DXFvpmFqiQH8syUWfs0/rNxkgEyxrQuzpH5A5uWr0aDWfE34HoK0fMh86azG7dXIvyFSjd35y8IV0fqpeTkK/VPDyS/GU5jzDY/f6oZGrmFULjgAErSY= Original-Received: by 10.140.82.40 with SMTP id f40mr4009456rvb.0.1207025759699; Mon, 31 Mar 2008 21:55:59 -0700 (PDT) Original-Received: by 10.141.193.8 with HTTP; Mon, 31 Mar 2008 21:55:59 -0700 (PDT) Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:94088 Archived-At: Hi, In find-file-noselect, confirmation is required for filesize > large-file-warning-threshold, yet in insert-file-1, it is not. Is there a reason large files should be allowed to be inserted -- but not loaded by themselves -- without confirmation? If not, I propose the patch below. thanks, Adrian ------------ Index: files.el =================================================================== 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 04:55:25 -0000 *************** *** 1796,1801 **** --- 1796,1811 ---- (if (file-directory-p filename) (signal 'file-error (list "Opening input file" "file is a directory" filename))) + ;; Check whether the file is uncommonly large (see find-file-noselect): + (let (size) + (when (and large-file-warning-threshold + (setq size (nth 7 (file-attributes filename))) + (> size large-file-warning-threshold) + (not (y-or-n-p + (format "File %s is large (%dMB), really insert? " + (file-name-nondirectory filename) + (/ size 1048576))))) + (error "Aborted"))) (let* ((buffer (find-buffer-visiting (abbreviate-file-name (file-truename filename)) #'buffer-modified-p)) (tem (funcall insert-func filename))) Diffs between working revision and workfile end here.