Re: [O] [BUG] (error Lisp nesting exceeds `max-lisp-eval-depth')

2013-02-13 Thread Christopher Schmidt
Sebastien Vauban wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org 
writes:
 Since the last pull I made, I can't expand anymore BBDB aliases in
 Gnus...  because of Org!
 Debugger entered--Lisp error: (error Lisp nesting exceeds 
 `max-lisp-eval-depth')

It looks like this is orgstruct-mode and yas-snippet both hijacking the
TAB key and ultimately falling back to each other.  Could you please
give master + this patch a try?
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8672,7 +8672,8 @@ should be checked in for a command to execute outside of tables.
  'item-body)))
 (org-run-like-in-org-mode ',fun)
 t))
-  (let ((binding (let ((orgstruct-mode)) (key-binding ,key
+  (let* ((orgstruct-mode)
+		 (binding (key-binding ,key)))
 (if (keymapp binding)
 (set-temporary-overlay-map binding)
   (call-interactively

Christopher


Re: [O] [BUG] (error Lisp nesting exceeds `max-lisp-eval-depth')

2013-02-13 Thread Sebastien Vauban
Hi Christopher,

Christopher Schmidt wrote:
 Sebastien Vauban writes:
 Since the last pull I made, I can't expand anymore BBDB aliases in
 Gnus...  because of Org!
 Debugger entered--Lisp error: (error Lisp nesting exceeds
 max-lisp-eval-depth')

 It looks like this is orgstruct-mode and yas-snippet both hijacking the
 TAB key and ultimately falling back to each other.  Could you please
 give master + this patch a try?

 --- a/lisp/org.el
 +++ b/lisp/org.el
 @@ -8672,7 +8672,8 @@ should be checked in for a command to execute outside 
 of tables.
   'item-body)))
  (org-run-like-in-org-mode ',fun)
  t))
 -  (let ((binding (let ((orgstruct-mode)) (key-binding ,key
 +  (let* ((orgstruct-mode)
 +  (binding (key-binding ,key)))
  (if (keymapp binding)
  (set-temporary-overlay-map binding)
(call-interactively

Well, it seems to yes. Thanks!

What's weird is that I applied the patch, and then did C-M-x with the cursor
in the function. I did test composing an email, and it still did not work.

I restarted Emacs to be really, really sure, and now it works!

So, I don't know what's bad in the above procedure (C-M-x of the fucntion),
but your patch works, yes.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] [BUG] (error Lisp nesting exceeds `max-lisp-eval-depth')

2013-02-13 Thread Christopher Schmidt
Sebastien Vauban wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org 
writes:
 What's weird is that I applied the patch, and then did C-M-x with the
 cursor in the function. I did test composing an email, and it still
 did not work.

 I restarted Emacs to be really, really sure, and now it works!

 So, I don't know what's bad in the above procedure (C-M-x of the
 fucntion), but your patch works, yes.

That is expected.  The function is only executed the very first time you
enable orgstruct\(++\)-mode.

orgstruct-mode is an ugly hack.  So is yasnippet.  There is no fix for
this problem, just a workaround that can introduce other issues in
somewhat rare and obscure corner cases.

I applied the patch.

7c27e57 org.el: Disable orgstruct-mode when falling back to original command

Christopher



Re: [O] [BUG] (error Lisp nesting exceeds `max-lisp-eval-depth')

2013-02-13 Thread Sebastien Vauban
Hi Christopher,

Christopher Schmidt wrote:
 Sebastien Vauban wxhgmqzgw...@spammotel.com writes:
 What's weird is that I applied the patch, and then did C-M-x with the
 cursor in the function. I did test composing an email, and it still
 did not work.

 I restarted Emacs to be really, really sure, and now it works!

 So, I don't know what's bad in the above procedure (C-M-x of the
 fucntion), but your patch works, yes.

 That is expected.  The function is only executed the very first time you
 enable orgstruct\(++\)-mode.

 orgstruct-mode is an ugly hack.  So is yasnippet.  There is no fix for
 this problem, just a workaround that can introduce other issues in
 somewhat rare and obscure corner cases.

 I applied the patch.

 7c27e57 org.el: Disable orgstruct-mode when falling back to original 
 command

Thanks for the explanation to the mystery, and for the patch.

Best regards,
  Seb

-- 
Sebastien Vauban




[O] [BUG] (error Lisp nesting exceeds `max-lisp-eval-depth')

2013-02-12 Thread Sebastien Vauban
Hello,

Since the last pull I made, I can't expand anymore BBDB aliases in Gnus...
because of Org!

--8---cut here---start-8---
Debugger entered--Lisp error: (error Lisp nesting exceeds 
`max-lisp-eval-depth')
  yas--all-parents(text-mode)
  (lambda (mode) (yas--all-parents mode))(text-mode)
  mapcar((lambda (mode) (yas--all-parents mode)) (text-mode message-mode))
  cl-mapcar((lambda (mode) (yas--all-parents mode)) (text-mode message-mode))
  apply(cl-mapcar (lambda (mode) (yas--all-parents mode)) (text-mode 
message-mode) nil)
  mapcan((lambda (mode) (yas--all-parents mode)) (text-mode message-mode))
  (append modes-to-activate (mapcan (function (lambda (mode) (yas--all-parents 
mode))) modes-to-activate))
  (remove-duplicates (append modes-to-activate (mapcan (function (lambda (mode) 
(yas--all-parents mode))) modes-to-activate)))
  (let ((modes-to-activate (list major-mode)) (mode major-mode)) (while (setq 
mode (get mode (quote derived-mode-parent))) (setq modes-to-activate (cons mode 
modes-to-activate))) (progn (let ((--dolist-tail-- (yas-extra-modes)) mode) 
(while --dolist-tail-- (setq mode (car --dolist-tail--)) (setq 
modes-to-activate (cons mode modes-to-activate)) (setq --dolist-tail-- (cdr 
--dolist-tail--) (remove-duplicates (append modes-to-activate (mapcan 
(function (lambda (mode) (yas--all-parents mode))) modes-to-activate
  yas--modes-to-activate()
  (mapcar (function (lambda (mode-name) (gethash mode-name yas--tables))) 
(yas--modes-to-activate))
  (remove nil (mapcar (function (lambda (mode-name) (gethash mode-name 
yas--tables))) (yas--modes-to-activate)))
  yas--get-snippet-tables()
  (mapcan (function (lambda (table) (yas--fetch table 
(buffer-substring-no-properties start end (yas--get-snippet-tables))
  (setq templates (mapcan (function (lambda (table) (yas--fetch table 
(buffer-substring-no-properties start end (yas--get-snippet-tables)))
  (while (and (not done) syntaxes) (setq syntax (car syntaxes)) (setq syntaxes 
(cdr syntaxes)) (save-excursion (skip-syntax-backward syntax) (setq start 
(point))) (setq templates (mapcan (function (lambda (table) (yas--fetch table 
(buffer-substring-no-properties start end (yas--get-snippet-tables))) (if 
templates (setq done t) (setq start end)))
  (let ((start (point)) (end (point)) (syntaxes yas-key-syntaxes) syntax done 
templates) (while (and (not done) syntaxes) (setq syntax (car syntaxes)) (setq 
syntaxes (cdr syntaxes)) (save-excursion (skip-syntax-backward syntax) (setq 
start (point))) (setq templates (mapcan (function (lambda (table) (yas--fetch 
table (buffer-substring-no-properties start end (yas--get-snippet-tables))) 
(if templates (setq done t) (setq start end))) (list templates start end))
  yas--current-key()
  (if field (save-restriction (narrow-to-region (yas--field-start field) 
(yas--field-end field)) (yas--current-key)) (yas--current-key))
  (setq templates-and-pos (if field (save-restriction (narrow-to-region 
(yas--field-start field) (yas--field-end field)) (yas--current-key)) 
(yas--current-key)))
  (if (and yas-expand-only-for-last-commands (not (member last-command 
yas-expand-only-for-last-commands))) nil (setq templates-and-pos (if field 
(save-restriction (narrow-to-region (yas--field-start field) (yas--field-end 
field)) (yas--current-key)) (yas--current-key
  (let (templates-and-pos) (if (and yas-expand-only-for-last-commands (not 
(member last-command yas-expand-only-for-last-commands))) nil (setq 
templates-and-pos (if field (save-restriction (narrow-to-region 
(yas--field-start field) (yas--field-end field)) (yas--current-key)) 
(yas--current-key (if (and templates-and-pos (first templates-and-pos)) 
(yas--expand-or-prompt-for-template (first templates-and-pos) (second 
templates-and-pos) (car (cdr (cdr templates-and-pos (yas--fallback (quote 
trigger-key
  yas-expand()
  call-interactively(yas-expand)
  (if (keymapp binding) (set-temporary-overlay-map binding) (call-interactively 
(or binding (quote orgstruct-error
  (let ((binding (let ((orgstruct-mode)) (key-binding   (if (keymapp 
binding) (set-temporary-overlay-map binding) (call-interactively (or binding 
(quote orgstruct-error)
  (if (let* ((org-heading-regexp (concat ^ orgstruct-heading-prefix-regexp 
\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[   ]*$)) (org-outline-regexp (concat 
orgstruct-heading-prefix-regexp \\*+ )) (org-outline-regexp-bol (concat ^ 
org-outline-regexp)) (outline-regexp org-outline-regexp) 
(outline-heading-end-regexp \n) (outline-level (quote outline-level)) 
(outline-heading-alist)) (when (org-context-p (quote headline) (quote item) 
nil) (org-run-like-in-org-mode (quote org-cycle)) t)) nil (let ((binding (let 
((orgstruct-mode)) (key-binding (if (keymapp binding) 
(set-temporary-overlay-map binding) (call-interactively (or binding (quote 
orgstruct-error))
  (unless (let* ((org-heading-regexp (concat ^ 
orgstruct-heading-prefix-regexp 

Re: [O] [BUG] (error Lisp nesting exceeds `max-lisp-eval-depth')

2013-02-12 Thread Bastien


Hi Sébastien,

Sebastien Vauban
wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes:

 Since the last pull I made, I can't expand anymore BBDB aliases in Gnus...
 because of Org!

Do you have the same error when you don't load yasnippets?

It looks like this is a bad interaction between yasnippets and
orgstruct++-mode, not a bug only in orgstruct++-mode.

Thanks,

-- 
 Bastien




Re: [O] [BUG] (error Lisp nesting exceeds `max-lisp-eval-depth')

2013-02-12 Thread Sebastien Vauban
HI Bastien,

Bastien wrote:
 Sebastien Vauban writes:

 Since the last pull I made, I can't expand anymore BBDB aliases in Gnus...
 because of Org!

 Do you have the same error when you don't load yasnippets?

 It looks like this is a bad interaction between yasnippets and
 orgstruct++-mode, not a bug only in orgstruct++-mode.

After testing: nope, it does not occur when YASnippet is not loaded.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] [BUG] (error Lisp nesting exceeds `max-lisp-eval-depth')

2013-02-12 Thread Bastien


Hi Sébastien,

Sebastien Vauban
wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes:

 After testing: nope, it does not occur when YASnippet is not loaded.

Now that John H. gave me some directions on using yasnippet, I'm ready
to test further and to hunt your bug.

Would you mind sharing the minimal yas/org config I need to reproduce
the problem?  Let me insist on minimal :)

Thanks,

-- 
 Bastien




Re: [O] [BUG] (error Lisp nesting exceeds `max-lisp-eval-depth')

2013-02-12 Thread Sebastien Vauban
Bastien,

Bastien wrote:
 Sebastien Vauban writes:

 After testing: nope, it does not occur when YASnippet is not loaded.

 Now that John H. gave me some directions on using yasnippet, I'm ready
 to test further and to hunt your bug.

 Would you mind sharing the minimal yas/org config I need to reproduce
 the problem?  Let me insist on minimal :)

Okaayyy, understood! ;-)

#+begin_src emacs-lisp
  (add-to-list 'load-path ~/Public/Repositories/yasnippet)

  ;; Yet Another Snippet extension for Emacs
  (require 'yasnippet)

  ;; root directories that store the snippets
  (setq yas/root-directory nil)
  (let ((my-snippets ~/src/yasnippet/snippets)
(local-snippets ~/Public/Repositories/yasnippet/snippets))
(when (file-directory-p local-snippets)
  (add-to-list 'yas/root-directory local-snippets))
;; the first element is always the user-created snippets directory
(when (file-directory-p my-snippets)
  (add-to-list 'yas/root-directory my-snippets)))

  ;; enable the YASnippet menu and tab-trigger expansion in *all*
  ;; buffers
  (yas/global-mode 1)

  ;; text that will be used in menu to represent the trigger
  (setq yas/trigger-symbol  tab)

  ;; allow YASnippet to do its thing in Org files
  (when (fboundp 'yas/expand)

(defun yas/org-very-safe-expand ()
  (let ((yas/fallback-behavior 'return-nil))
(yas/expand)))

(add-hook 'org-mode-hook
  (lambda ()
(set (make-local-variable 'yas/trigger-key) (kbd tab)) ;; 
needed?
(add-to-list 'org-tab-first-hook
 'yas/org-very-safe-expand)
(define-key yas/keymap (kbd tab) 'yas/next-field ;; 
needed?
#+end_src

Best regards,
  Seb

-- 
Sebastien Vauban