joaotavora / yasnippet

A template system for Emacs
http://joaotavora.github.io/yasnippet/
2.8k stars 311 forks source link

Test failure when recent Org-mode is installed #852

Open spwhitton opened 7 years ago

spwhitton commented 7 years ago

If I have Org 9.0.9 installed on my system (using a distribution package), the following test fails. Otherwise, using the version of Org bundled with Emacs 25.2.2, it passes. Thanks!

Test yas-org-native-tab-in-source-block backtrace:
  (if (unwind-protect (setq value-706 (apply fn-704 args-705)) (setq f
  (let (form-description-708) (if (unwind-protect (setq value-706 (app
  (let ((value-706 (quote ert-form-evaluation-aborted-707))) (let (for
  (let ((fn-704 (function looking-at)) (args-705 (list ">> done!"))) (
  (progn (require (quote font-lock)) (font-lock-mode 1) (org-mode) (ya
  (unwind-protect (progn (require (quote font-lock)) (font-lock-mode 1
  (let ((noninteractive nil) (change-major-mode-after-body-hook (funct
  (save-current-buffer (set-buffer temp-buffer) (let ((noninteractive 
  (let ((temp-buffer (generate-new-buffer "*yas-temp*"))) (save-curren
  (let ((text-mode-hook (quote (yas-minor-mode))) (org-src-tab-acts-na
  (closure (yas--foobarbaz yas--barbaz t) nil (let ((text-mode-hook (q
  funcall((closure (yas--foobarbaz yas--barbaz t) nil (let ((text-mode
  (progn (mapc (function yas-make-file-or-dirs) dirs) (funcall fn))
  (unwind-protect (progn (mapc (function yas-make-file-or-dirs) dirs) 
  (progn (if with-temp-message (progn (setq current-message (current-m
  (unwind-protect (progn (if with-temp-message (progn (setq current-me
  (let ((with-temp-message "") (current-message)) (unwind-protect (pro
  (let* ((default-directory (make-temp-file "yasnippet-fixture" t)) (y
  yas-call-with-snippet-dirs(((".emacs.d/snippets" ("text-mode" ("T" .
  (closure (yas--foobarbaz yas--barbaz t) nil (yas-call-with-snippet-d
  funcall((closure (yas--foobarbaz yas--barbaz t) nil (yas-call-with-s
  (unwind-protect (funcall fn) (let* ((--cl-var-- vars) (var nil) (--c
  (let* ((vars (yas-variables)) (saved-values (mapcar (function symbol
  yas-call-with-saving-variables((closure (yas--foobarbaz yas--barbaz 
  (closure (yas--foobarbaz yas--barbaz t) nil (yas-call-with-saving-va
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  ert-run-test([cl-struct-ert-test yas-org-native-tab-in-source-block 
  ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test a
  ert-run-tests(t #[385 "\306\307\"\203G\211\211G\310U\203\211@\20
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  eval((ert-run-tests-batch-and-exit))
  command-line-1(("-l" "package" "--eval" "(add-to-list 'package-direc
  command-line()
  normal-top-level()
Test yas-org-native-tab-in-source-block condition:
    (ert-test-failed
     ((should
       (looking-at ">> done!"))
      :form
      (looking-at ">> done!")
      :value nil))
   FAILED  68/68  yas-org-native-tab-in-source-block
npostavs commented 7 years ago

Hum, it also fails with the Emacs 26.bundled org-mode. This looks difficult to solve, might have to give up on some org-mode integration.

joaotavora commented 6 years ago

Hum, it also fails with the Emacs 26.bundled org-mode. This looks difficult to solve, might have to give up on some org-mode integration.

@npostavs , can you explain summarily why this "looks difficult to solve"?

npostavs commented 6 years ago

My vague recollection is that org-mode changed around the timing of how text gets moved into the source-block buffer, such that it's no longer feasible for yasnippet to catch it. I think we need to get some hooks added to org-mode so we can get notified about it.

edgimar commented 6 years ago

Has this issue been brought up on the org-mode mailing list? If so, could someone post a link to the thread? It would be great to see it progress!

npostavs commented 6 years ago

Has this issue been brought up on the org-mode mailing list?

No, I don't think so. I've been looking at this a bit yesterday, and even though the test passes in Emacs 25, trying to do something similar interactively fails with some error in the post-command hook (i.e., the test case is not entirely representative). This org-mode integration is just a huge mess, I'm afraid. :(

npostavs commented 5 years ago

My vague recollection is that org-mode changed around the timing of how text gets moved into the source-block buffer, such that it's no longer feasible for yasnippet to catch it.

This was mostly wrong. The actual problem seems to be that org stopped doing the fontification step where it's not needed, as is the case for text-mode, hence this test failure.

Additionally I left a bunch of garbage code in yasnippet's org-mode handling, which prevented it from working even for fontified modes. That should now be fixed.

I think we need to get some hooks added to org-mode so we can get notified about it.

This is still needed for text-mode src blocks, and forward-compatibility in case org-mode internals change.