From: "Adrian Robert" <adrian.b.robert@gmail.com>
To: "emacs- devel" <emacs-devel@gnu.org>
Subject: Large-file check in files.el
Date: Tue, 1 Apr 2008 07:55:59 +0300 [thread overview]
Message-ID: <55f7df060803312155wdfe27c0w5bbbaac1562285a4@mail.gmail.com> (raw)
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.
next reply other threads:[~2008-04-01 4:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-01 4:55 Adrian Robert [this message]
2008-04-01 5:57 ` Large-file check in files.el Stefan Monnier
2008-04-01 12:02 ` Adrian Robert
2008-04-01 15:56 ` Stefan Monnier
2008-04-02 17:59 ` Adrian Robert
2008-04-03 14:03 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55f7df060803312155wdfe27c0w5bbbaac1562285a4@mail.gmail.com \
--to=adrian.b.robert@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.