emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Long lines prevent Org mode!
Date: Tue, 07 Jan 2014 23:41:39 -0500	[thread overview]
Message-ID: <87d2k313wc.fsf@gmail.com> (raw)
In-Reply-To: 87txdfw9ij.fsf@iro.umontreal.ca

François Pinard <pinard@iro.umontreal.ca> 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	other threads:[~2014-01-08  4:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08  1:24 Long lines prevent Org mode! François Pinard
2014-01-08  4:41 ` Nick Dokos [this message]
2014-01-08  5:21   ` François Pinard
2014-01-08  6:05     ` Nick Dokos
2014-01-08  9:18     ` Sebastien Vauban
2014-01-08 12:10       ` Nick Dokos
2014-01-08 12:29       ` François Pinard
2014-01-09  8:57         ` Sebastien Vauban

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.orgmode.org/

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

  git send-email \
    --in-reply-to=87d2k313wc.fsf@gmail.com \
    --to=ndokos@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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