* Disabling a mode based on the size of a buffer?
@ 2013-08-20 17:08 Tim Visher
2013-08-20 21:44 ` Michael Heerdegen
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Tim Visher @ 2013-08-20 17:08 UTC (permalink / raw)
To: emacs
Hi All,
When a buffer gets to a certain size, paredit mode specifically begins
to struggle, as do some other modes.
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.
Thoughts?
--
In Christ,
Timmy V.
http://blog.twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Disabling a mode based on the size of a buffer?
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
[not found] ` <mailman.451.1377049349.10748.help-gnu-emacs@gnu.org>
2 siblings, 2 replies; 8+ messages in thread
From: Michael Heerdegen @ 2013-08-20 21:44 UTC (permalink / raw)
To: help-gnu-emacs
Tim Visher <tim.visher@gmail.com> writes:
> Hi All,
>
> When a buffer gets to a certain size, paredit mode specifically begins
> to struggle, as do some other modes.
I don't see that for paredit. In a buffer with >10000 lines, any
paredit command is still executed without measurable delay. In which
way does it struggle for you? What are these other modes?
> 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.
No, not that I knew. You could use a timer to observe the buffer size.
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Disabling a mode based on the size of a buffer?
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 1:41 ` Juanma Barranquero
2013-08-21 14:11 ` Tim Visher
[not found] ` <mailman.451.1377049349.10748.help-gnu-emacs@gnu.org>
2 siblings, 1 reply; 8+ messages in thread
From: Juanma Barranquero @ 2013-08-21 1:41 UTC (permalink / raw)
To: Tim Visher; +Cc: emacs
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Disabling a mode based on the size of a buffer?
2013-08-20 21:44 ` Michael Heerdegen
@ 2013-08-21 14:10 ` Tim Visher
2013-08-22 5:25 ` Julien Cubizolles
1 sibling, 0 replies; 8+ messages in thread
From: Tim Visher @ 2013-08-21 14:10 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: emacs
On Tue, Aug 20, 2013 at 5:44 PM, Michael Heerdegen
<michael_heerdegen@web.de> wrote:
> Tim Visher <tim.visher@gmail.com> writes:
>
>> Hi All,
>>
>> When a buffer gets to a certain size, paredit mode specifically begins
>> to struggle, as do some other modes.
>
> I don't see that for paredit. In a buffer with >10000 lines, any
> paredit command is still executed without measurable delay. In which
> way does it struggle for you? What are these other modes?
Mine is [31000 lines][bible.cljs]. The enabled modes in that buffer are
Clojure Auto-Composition Auto-Compression Auto-Encryption
Column-Number Cua Diff-Auto-Refine Eldoc Electric-Indent Electric-Pair
Erc-Autojoin Erc-Button Erc-Fill Erc-Irccontrols Erc-List Erc-Match
Erc-Menu Erc-Move-To-Prompt Erc-Netsplit Erc-Networks Erc-Noncommands
Erc-Pcomplete Erc-Readonly Erc-Ring Erc-Stamp Erc-Track Erc-Track
File-Name-Shadow Font-Lock Global-Font-Lock Global-Hl-Line Hi-Lock Hs
Idle-Highlight Ido-Everywhere Ido-Ubiquitous Line-Number
Nrepl-Interaction Recentf Shell-Dirtrack Show-Paren Textmate
Transient-Mark Whitespace Winner Yas
I'm assuming several of them could be the culprit, but I would guess
it would be Clojure mode attempting to do syntax highlighting.
Anyway, if you position your cursor just inside the verses vector in
[this file][bible.cljs] and use
`paredit-splice-sexp-killing-backward`, does it work lickety-split?
[bible.cljs]: https://raw.github.com/timvisher/bible-plan/master/src/cljs/bible_plan/bible.cljs
--
In Christ,
Timmy V.
http://blog.twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Disabling a mode based on the size of a buffer?
2013-08-21 1:41 ` Juanma Barranquero
@ 2013-08-21 14:11 ` Tim Visher
0 siblings, 0 replies; 8+ messages in thread
From: Tim Visher @ 2013-08-21 14:11 UTC (permalink / raw)
To: Juanma Barranquero; +Cc: emacs
On Tue, Aug 20, 2013 at 9:41 PM, Juanma Barranquero <lekktu@gmail.com> wrote:
> 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)
That'd do it. :)
--
In Christ,
Timmy V.
http://blog.twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Disabling a mode based on the size of a buffer?
2013-08-20 21:44 ` Michael Heerdegen
2013-08-21 14:10 ` Tim Visher
@ 2013-08-22 5:25 ` Julien Cubizolles
1 sibling, 0 replies; 8+ messages in thread
From: Julien Cubizolles @ 2013-08-22 5:25 UTC (permalink / raw)
To: help-gnu-emacs
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Tim Visher <tim.visher@gmail.com> writes:
>
>> Hi All,
>>
>> When a buffer gets to a certain size, paredit mode specifically begins
>> to struggle, as do some other modes.
>
> I don't see that for paredit. In a buffer with >10000 lines, any
> paredit command is still executed without measurable delay. In which
> way does it struggle for you? What are these other modes?
I'm experiencing it too, with 3000 lines LaTeX buffers, typing '(' can
take up to one second to insert a pair of parenthesis.
Here is the mode description :
Auto-Composition Auto-Compression Auto-Encryption
Autopair Autopair-Global Blink-Cursor Diff-Auto-Refine Display-Time
Erc-Autojoin Erc-Button Erc-Fill Erc-Irccontrols Erc-List Erc-Match
Erc-Menu Erc-Move-To-Prompt Erc-Netsplit Erc-Networks Erc-Noncommands
Erc-Pcomplete Erc-Readonly Erc-Ring Erc-Stamp Erc-Track
File-Name-Shadow Flyspell-Lazy Font-Lock Global-Font-Lock
Helm-Match-Plugin Ido-Everywhere Line-Number Menu-Bar Mouse-Wheel
Paredit Rainbow-Delimiters Reftex Shell-Dirtrack Show-Paren Tabbar
Tabbar-Mwheel Tex-Fold Tex-Pdf Tex-Source-Correlate Tooltip
Transient-Mark Workgroups Yas Yas-Global
(Information about these minor modes follows the major mode info.)
LaTeX/FPS mode defined in `tex-site.el':
Julien.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Disabling a mode based on the size of a buffer?
[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
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2013-08-25 13:52 UTC (permalink / raw)
To: help-gnu-emacs
> Not very sofisticate:
> (add-hook 'after-change-functions
> (lambda (&rest _ignore)
> (when (> (buffer-size) 1000000)
> (fundamental-mode)))
> nil t)
It's still just a workaround, and unless the buffer is really "too
large", this should be reported as a bug (ideally with an
easy-to-reproduce-recipe).
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Disabling a mode based on the size of a buffer?
2013-08-25 13:52 ` Stefan Monnier
@ 2013-08-25 21:00 ` Juanma Barranquero
0 siblings, 0 replies; 8+ messages in thread
From: Juanma Barranquero @ 2013-08-25 21:00 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Emacs Help List
On Sun, Aug 25, 2013 at 3:52 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
> It's still just a workaround
And a crude one, to boot.
J
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-08-25 21:00 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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).