Richard Stallman wrote:
Should `M-x insert-file' also check the file size and ask for
confirmation?
That seems like a good idea.
Note that insert-file-1 is called by both insert-file and
insert-file-literally:
2006-12-01 Kevin Rodgers <[EMAIL PROTECTED]>
* files.el (insert-file-1): Compare file size to
large-file-warning-threshold and request confirmation when
warranted.
*** files.el.orig 2006-11-28 02:20:32 -0000
--- files.el 2006-12-01 11:53:47.316966000 -0700
***************
*** 1695,1700 ****
--- 1695,1710 ----
(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)))
--
Kevin
_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug