[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/files.el,v
From: |
Adrian Robert |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/files.el,v |
Date: |
Sat, 05 Apr 2008 12:03:25 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Adrian Robert <arobert> 08/04/05 12:03:24
Index: files.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/files.el,v
retrieving revision 1.967
retrieving revision 1.968
diff -u -b -r1.967 -r1.968
--- files.el 3 Apr 2008 20:06:45 -0000 1.967
+++ files.el 5 Apr 2008 12:03:23 -0000 1.968
@@ -1507,6 +1507,17 @@
:version "22.1"
:type '(choice integer (const :tag "Never request confirmation" nil)))
+(defun abort-if-file-too-large (size op-type)
+ "If file SIZE larger than LARGE-FILE-WARNING-THRESHOLD, allow user to abort.
+OP-TYPE specifies the file operation being performed (for message to user)."
+ (when (and large-file-warning-threshold size
+ (> size large-file-warning-threshold)
+ (not (y-or-n-p
+ (format "File %s is large (%dMB), really %s? "
+ (file-name-nondirectory filename)
+ (/ size 1048576) op-type))))
+ (error "Aborted")))
+
(defun find-file-noselect (filename &optional nowarn rawfile wildcards)
"Read file FILENAME into a buffer and return the buffer.
If a buffer exists visiting FILENAME, return that one, but
@@ -1558,16 +1569,8 @@
(if (or find-file-existing-other-name find-file-visit-truename)
(setq buf other))))
;; Check to see if the file looks uncommonly large.
- (when (and large-file-warning-threshold (nth 7 attributes)
- ;; Don't ask again if we already have the file or
- ;; if we're asked to be quiet.
- (not (or buf nowarn))
- (> (nth 7 attributes) large-file-warning-threshold)
- (not (y-or-n-p
- (format "File %s is large (%dMB), really open? "
- (file-name-nondirectory filename)
- (/ (nth 7 attributes) 1048576)))))
- (error "Aborted"))
+ (when (not (or buf nowarn))
+ (abort-if-file-too-large (nth 7 attributes) "open"))
(if buf
;; We are using an existing buffer.
(let (nonexistent)
@@ -1796,6 +1799,8 @@
(if (file-directory-p filename)
(signal 'file-error (list "Opening input file" "file is a directory"
filename)))
+ ;; Check whether the file is uncommonly large
+ (abort-if-file-too-large (nth 7 (file-attributes filename)) "insert")
(let* ((buffer (find-buffer-visiting (abbreviate-file-name (file-truename
filename))
#'buffer-modified-p))
(tem (funcall insert-func filename)))
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Stefan Monnier, 2008/04/03
- [Emacs-diffs] Changes to emacs/lisp/files.el,v,
Adrian Robert <=
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Juanma Barranquero, 2008/04/05
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Glenn Morris, 2008/04/11
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Stefan Monnier, 2008/04/18
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Juri Linkov, 2008/04/22
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Dan Nicolaescu, 2008/04/27
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Stefan Monnier, 2008/04/29