[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs22 large file y-or-n-p

From: Mathias Dahl
Subject: Re: Emacs22 large file y-or-n-p
Date: Wed, 14 Jun 2006 11:50:45 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt)

Brendan Halpin <> writes:

> Is there a lightweight way to avoid the check for RMAIL? I've
> looked at the code (for find-file-noselect) and that permits
> different size thresholds (and turning the check off altogether). 
> Would defadvice around the rmail defun provide a handle? e.g.
> temporarily raise the threshold variable's value to 100MB and
> revert it afterwards?

If I had this problem I would have hacked rmail.el, doing the below,
or similar.

Changed this:

       (let ((enable-local-variables nil))
         (find-file-noselect file-name))

to this:

       (let ((large-file-warning-threshold nil)
             (enable-local-variables nil))
         (find-file-noselect file-name))

or maybe to this:

       (let ((large-file-warning-threshold 40000000)
             (enable-local-variables nil))
         (find-file-noselect file-name))

Or, in this code in files.el:

        (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 (string-match large-file-warning-exceptions filename))


                   (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)))))

;; New variable

(defvar large-file-warning-exceptions nil
 "Regexp matching files that wont get their size checked")

;; And in your .emacs

(setq large-file-warning-exceptions "my_rmail_file_regexp")

This is probably the best solution in that it is more general.

But I would not recommend changing Emacs "internal" lisp files in case
you are prepared to get into trouble when new versions come.

Or use the defadvice adviced (haha) by some people here.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]