emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Long lines prevent Org mode!


From: Nick Dokos
Subject: Re: [O] Long lines prevent Org mode!
Date: Tue, 07 Jan 2014 23:41:39 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

François Pinard <address@hidden> writes:

> Hi, Org maintainers.
>
> This morning, while using my little org-grep tool, I got a "Stack
> overflow in regexp matcher" diagnostic.  I first looked for a bug in my
> things, but the problem lies in Org mode.  It cannot be activated if the
> Org buffer happens to contain a long line.
>
> In the *Scratch* buffer, I wrote this little function:
>
>    (defun essai (n)
>      (with-temp-buffer
>        (insert (make-string n ?x))
>        (org-mode)))
>
> and called it with various values of N.  It works fine for small N, but
> breaks when (on the machine here) N reaches 33333.
>
> I wonder if the following article could help:
>
>   [[https://groups.google.com/forum/#!topic/gnu.emacs.help/pxfMC5f7JHg][Stack 
> overflow in regexp matcher - Google Groupes]]
>

I think it is the same problem. The backtrace in this case is

,----
| Debugger entered--Lisp error: (error "Stack overflow in regexp matcher")
|   looking-at(".*:ARCHIVE:")
|   (if (looking-at (concat ".*:" org-archive-tag ":")) (message "%s" 
(substitute-command-keys "Subtree is archived and stays closed.  Use 
\\[org-force-cycle-archived] to cycle it anyway.")))
|   ...
|   org-mode()
|   (progn (insert (make-string n 120)) (org-mode))
|   (unwind-protect (progn (insert (make-string n 120)) (org-mode)) (and 
(buffer-name temp-buffer) (kill-buffer temp-buffer)))
|   (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn 
(insert (make-string n 120)) (org-mode)) (and (buffer-name temp-buffer) 
(kill-buffer temp-buffer))))
|   (let ((temp-buffer (generate-new-buffer " *temp*"))) ...)
|   essai(33333)
|   eval((essai 33333) nil)
`----


and in fact, you can leave org out of the picture altogether: create an
empty buffer, insert 33333 x's by hand, go to the beginning and evaluate

   (looking-at ".*foo")

As Stefan says in the thread you pointed out, it's a limitation of the
emacs regexp engine.

> François
>
> P.S. Would someone be kind enough to teach me the wisdom about how to
> insert Org mode fragments in an email so it is received the most legibly
> possible at the other end?  Presumably, there is a Gnus way (which is
> it?) yet many people do not use it.
>
>

I cut and paste and then use either C-c m (bound to
message-mark-inserted-region) which produces this style:

--8<---------------cut here---------------start------------->8---
some code
--8<---------------cut here---------------end--------------->8---

or C-c q (bound to boxquote-region) which produces this style:

,----
| some quoted material
`----

I use the first one for things that a recipient might want to cut
and paste in order to experiment with them. I use the second to quote
immutable stuff (e.g. doc strings).

Of course, if your problem is that your mailer (or some mailer along the
way) mangles the content, then the safest thing to do is to put it in an
attachment or post it on some pastebin and send a link.
-- 
Nick




reply via email to

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