unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Tim Visher <tim.visher@gmail.com>
Cc: emacs <help-gnu-emacs@gnu.org>
Subject: Re: Disabling a mode based on the size of a buffer?
Date: Wed, 21 Aug 2013 03:41:42 +0200	[thread overview]
Message-ID: <CAAeL0SQv1MnE2Q=MD4vVe+o-F++BGrTtsoQbKhjAt2UDoGSRKA@mail.gmail.com> (raw)
In-Reply-To: <CAHa53uyK8m-4HbPCA-MngaTfD61M4PYUiCmzuAR6tVFVJVwH2A@mail.gmail.com>

On Tue, Aug 20, 2013 at 7:08 PM, Tim Visher <tim.visher@gmail.com> wrote:

> I'm basically wondering if there are predefined hooks with which I can
> make a decision to disable said modes if a buffer has reached a
> certain size limit.

Not very sofisticate:

(add-hook 'after-change-functions
          (lambda (&rest _ignore)
            (when (> (buffer-size) 1000000)
              (fundamental-mode)))
          nil t)

HTH,

   J



  parent reply	other threads:[~2013-08-21  1:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20 17:08 Disabling a mode based on the size of a buffer? Tim Visher
2013-08-20 21:44 ` Michael Heerdegen
2013-08-21 14:10   ` Tim Visher
2013-08-22  5:25   ` Julien Cubizolles
2013-08-21  1:41 ` Juanma Barranquero [this message]
2013-08-21 14:11   ` Tim Visher
     [not found] ` <mailman.451.1377049349.10748.help-gnu-emacs@gnu.org>
2013-08-25 13:52   ` Stefan Monnier
2013-08-25 21:00     ` Juanma Barranquero

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='CAAeL0SQv1MnE2Q=MD4vVe+o-F++BGrTtsoQbKhjAt2UDoGSRKA@mail.gmail.com' \
    --to=lekktu@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tim.visher@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).