unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Mathias Dahl <brakjoller@gmail.com>
Subject: Re: Emacs22 large file y-or-n-p
Date: Wed, 14 Jun 2006 11:50:45 +0200	[thread overview]
Message-ID: <uslm83w22.fsf@gmail.com> (raw)
In-Reply-To: 87zmgg63vb.fsf@wivenhoe.staff8.ul.ie

Brendan Halpin <brendan.halpin@ul.ie> 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.

;;;;;;;; NEW CHECK STARTS HERE

                   (not (string-match large-file-warning-exceptions filename))

;;;;;;;; NEW CHECK ENDS HERE

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

/Mathias

  parent reply	other threads:[~2006-06-14  9:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-13 23:19 Emacs22 large file y-or-n-p Brendan Halpin
2006-06-14  0:15 ` Pascal Bourguignon
2006-06-14  8:20   ` Tim X
2006-06-14  8:34   ` Brendan Halpin
2006-06-14 15:58     ` Kevin Rodgers
     [not found]     ` <mailman.2887.1150300794.9609.help-gnu-emacs@gnu.org>
2006-06-14 16:08       ` Brendan Halpin
2006-06-14  8:16 ` Reiner Steib
2006-06-14  9:03 ` Stein Arild Strømme
2006-06-14  9:20   ` Brendan Halpin
2006-06-14  9:50 ` Mathias Dahl [this message]
2006-06-14 10:04   ` Brendan Halpin
2006-06-14 10:37     ` Giorgos Keramidas

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uslm83w22.fsf@gmail.com \
    --to=brakjoller@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).