emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: commit 5ea0228 has problem opening big org-mode file
Date: Mon, 25 Nov 2013 23:29:49 -0500	[thread overview]
Message-ID: <87pppn4wg2.fsf@gmail.com> (raw)
In-Reply-To: CAD3zm23N6zPAVyX5RwSvLmGDH3oQVkYA789bm5Lzpd=YvQhv7Q@mail.gmail.com

York Zhao <gtdplatform@gmail.com> writes:


> First goes .emacs file:
>
> (add-to-list 'load-path "path/to/org-mode")
> (add-to-list 'load-path "path/to/org-mode/lisp")  ; this line is the key
> (add-to-list 'load-path "path/to/yhj-mode")
> (require 'yhj-mode)
>
> Second goes yhj-mode.el:
>
> (require 'org)
> (define-derived-mode yhj-mode org-mode "yhj")
> (provide 'yhj-mode)
>
> Finally, file test.yz:
>
> # -*- mode:yhj -*-
>
> Open file "test.yz" and note the comment line not fortified, open "*message*"
> buffer and note the following error:
>
> File local-variables error: (error "Lisp nesting exceeds `max-lisp-eval-depth'")
>
> There are three keys to reproduce, first, you have to make two files, .emacs and
> "yhj-mode.el". Second, this line must be present:
>
> (add-to-list 'load-path "path/to/org-mode/lisp")  ; this line is the key
>
> Third, file "yhj-mode.el" has to be byte-compiled.
>

Thank you for the reproducer. I get the same result (and I don't need to
byte compile yhj-mode.el - the mention of the necessity of
byte-compilation led me to suspect the compiler, but since it happens
with uncompiled code, that theory went out the window.)

The problem is the following sequence of calls:

   find-file -> normal-mode -> set-auto-mode (nil) -> set-auto-mode-0 (nil)
       yhj-mode -> org-mode -> hack-local-variables -> hack-local-variables-apply(mode yhj) ->
           yhj-mode -> org-mode -> hack-local-variables -> ...

Setting the mode in a local variable section leads to this scenario,
something I did not test for my original "fix".

The best solution I can think of so far: revert commit 5ea0228,
and change org-mode-restart to call normal-mode, instead of org-mode.
normal-mode splits the setting of the mode from the setting of local
variables, so it would avoid the recursion.

I think (but I have not verified yet) that this would fix both the
problem that gave rise to commit 5ea0228 in the first place and this
bottomless recursion, without causing any other problems. I'll try it
out tomorrow if I find the time and submit a patch.

-- 
Nick

  reply	other threads:[~2013-11-26  4:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25  3:55 commit 5ea0228 has problem opening big org-mode file York Zhao
2013-11-25  4:28 ` Nick Dokos
2013-11-25 16:57   ` Nick Dokos
2013-11-25 19:26     ` Thomas S. Dye
2013-11-25 22:39       ` York Zhao
2013-11-26  1:38         ` York Zhao
2013-11-26  4:29           ` Nick Dokos [this message]
2013-11-26  4:53             ` Nick Dokos
2013-11-27  2:26               ` York Zhao
2013-11-27  2:29               ` Thomas S. Dye
2013-11-27 14:27               ` Nick Dokos
2013-11-27 18:58                 ` Achim Gratz
2013-11-27 19:23                   ` Nick Dokos
2013-11-27 19:53                     ` Achim Gratz
2013-11-26 19:25           ` Achim Gratz
2013-11-27  1:46             ` York Zhao
2013-11-27  7:24               ` Achim Gratz
2013-11-28  0:17                 ` York Zhao
2013-11-28  7:25                   ` Achim Gratz
2013-11-29  3:58                     ` York Zhao

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=87pppn4wg2.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).