From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: commit 5ea0228 has problem opening big org-mode file Date: Mon, 25 Nov 2013 23:29:49 -0500 Message-ID: <87pppn4wg2.fsf@gmail.com> References: <871u255cla.fsf@gmail.com> <878uwcbes9.fsf@alphaville.bos.redhat.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlAHs-0002pb-2v for emacs-orgmode@gnu.org; Mon, 25 Nov 2013 23:30:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlAHk-0007jY-Px for emacs-orgmode@gnu.org; Mon, 25 Nov 2013 23:30:12 -0500 Received: from plane.gmane.org ([80.91.229.3]:60965) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlAHk-0007hJ-KO for emacs-orgmode@gnu.org; Mon, 25 Nov 2013 23:30:04 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VlAHj-0005IX-FH for emacs-orgmode@gnu.org; Tue, 26 Nov 2013 05:30:03 +0100 Received: from pool-108-7-96-134.bstnma.fios.verizon.net ([108.7.96.134]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 26 Nov 2013 05:30:03 +0100 Received: from ndokos by pool-108-7-96-134.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 26 Nov 2013 05:30:03 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org York Zhao 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