From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Re: outline-flag-region: Variable binding depth exceeds max-specpdl-size Date: Tue, 21 May 2013 23:28:49 +0200 Message-ID: <871u9081ke.fsf@gmail.com> References: <878v388e02.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1369171769 17891 80.91.229.3 (21 May 2013 21:29:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 May 2013 21:29:29 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 21 23:29:21 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ueu7U-0004GP-Ng for geh-help-gnu-emacs@m.gmane.org; Tue, 21 May 2013 23:29:20 +0200 Original-Received: from localhost ([::1]:48482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ueu7U-0008Jl-8z for geh-help-gnu-emacs@m.gmane.org; Tue, 21 May 2013 17:29:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ueu7H-0008JJ-Ir for help-gnu-emacs@gnu.org; Tue, 21 May 2013 17:29:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ueu7E-0006Sr-Ae for help-gnu-emacs@gnu.org; Tue, 21 May 2013 17:29:07 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:39936) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ueu7E-0006SK-0h for help-gnu-emacs@gnu.org; Tue, 21 May 2013 17:29:04 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ueu7B-00045d-O2 for help-gnu-emacs@gnu.org; Tue, 21 May 2013 23:29:01 +0200 Original-Received: from g231235166.adsl.alicedsl.de ([92.231.235.166]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 May 2013 23:29:01 +0200 Original-Received: from tjolitz by g231235166.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 May 2013 23:29:01 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 106 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: g231235166.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:bbrLSdfZXbk9zzwScZVoNdvvT9Q= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:90963 Archived-At: Thorsten Jolitz writes: > I implemented a new (optional and customizable) feature for 'outshine.el': > behind every folded headline, a little 'cookie' can show the number of > hidden lines till the next visible headline. [...snip...] > This works alright so far, and when a folded buffer is expanded or the > number of hidden lines change, the cookies are updated correctly. But > obviously its a bit tedious to manually do > > ,------------------------------------------ > | M-:(outshine-show-hidden-lines-cookies) > `------------------------------------------ > > each time the status of the buffer changes, so the right thing to do > seems to be: > > ,----------------------------------------------- > | (add-hook 'outline-view-change-hook > | 'outshine-show-hidden-lines-cookies) > `----------------------------------------------- > > This worked shortly, but since then results in the following error: > > ,--------------------------------------------------------------------- > | outline-flag-region: Variable binding depth exceeds max-specpdl-size > `--------------------------------------------------------------------- > > Whats this error about and what would be a possible fix? There are > several reports about this error for several Emacs modes, but the > background and cure are not really explained. Following up to my own post, help and source code of 'outline-flag-region' and 'max-specpdl-size' do give some hints: ,--------------------------------------------------------------------------- | max-specpdl-size is a variable defined in `C source code'. | Its value is 1340 | Original value was 1300 | | This variable can be risky when used as a file-local variable. | | Documentation: | Limit on number of Lisp variable bindings and `unwind-protect's. | If Lisp code tries to increase the total number past this amount, | an error is signaled. | You can safely use a value considerably larger than the default value, | if that proves inconveniently small. However, if you increase it too far, | Emacs could run out of memory trying to make the stack bigger. | | You can customize this variable. `--------------------------------------------------------------------------- so it appears that in a call to 'outline-flag-region' more than 1340 Lisp variable bindings and `unwind-protect's are created. ,-------------------------------------------------------------------------- | outline-flag-region is a compiled Lisp function in `outline.el'. | | (outline-flag-region FROM TO FLAG) | | Hide or show lines from FROM to TO, according to FLAG. | If FLAG is nil then text is shown, while if FLAG is t the text is hidden. `-------------------------------------------------------------------------- But its hard to see where this happens in a (test) file with some 30 outline headlines. ,----------------------------------------------------------------------------- | (defun outline-flag-region (from to flag) | "Hide or show lines from FROM to TO, according to FLAG. | If FLAG is nil then text is shown, while if FLAG is t the text is hidden." | (remove-overlays from to 'invisible 'outline) | (when flag | ;; We use `front-advance' here because the invisible text begins at the | ;; very end of the heading, before the newline, so text inserted at FROM | ;; belongs to the heading rather than to the entry. | (let ((o (make-overlay from to nil 'front-advance))) | (overlay-put o 'evaporate t) | (overlay-put o 'invisible 'outline) | (overlay-put o 'isearch-open-invisible | (or outline-isearch-open-invisible-function | 'outline-isearch-open-invisible)))) | ;; Seems only used by lazy-lock. I.e. obsolete. | (run-hooks 'outline-view-change-hook)) `----------------------------------------------------------------------------- Looking at the code, I can't really see why a function called each time an outline region is flagged, that jumps to all visible headlines, checks if the headline is folded and/or if it has a "hidden-lines-cookie", and only in the first case gets the number of hidden lines before the next visible headline, would create so many variable bindings and unwind-protects. Any hints? PS And, by the way, if I could solve the problem described in this thread, 'outline-view-change-hook' would be quite useful for outshine.el and thus not obsolete any more? -- cheers, Thorsten