When texts in code blocks have [], it should not be trreated as cloze card.

Issue #23 closed
Shihpin Tseng
created an issue

For example, the following drill topic supposed to be simple topic type. But the haskell source code [ (x, y) | x <- mx, y <- my ] in code block make it to cloze card type.

*** List comprehensions                       :drill:
    xxxxxxxxxxxxx
    #+BEGIN_SRC haskell
      [ (x, y) | x <- mx, y <- my ]
    #+END_SRC
**** Answer
    xxxxxxxxxxxxx

Comments (16)

  1. Paul Sexton repo owner

    I don't see this behaviour - your example works normally for me (i.e. the Haskell code is displayed without any clozes). Are you using the latest version of org mode (8.2.10 or the development version from the repo)? Are you using the latest version of org-drill (from this repository)?

  2. Shihpin Tseng reporter

    Emacs version: GNU Emacs 25.0.50.1 (x86_64-apple-darwin14.0.0, NS appkit-1343.14 Version 10.10 (Build 14A389)) of 2014-11-03

    Org-mode version 8.3beta (release_8.3beta-525-gff1305 @ /Users/XXX/.emacs.d/site-lisp/org-mode/lisp/).

    The org-drill.el both build-in org-mode and from this repository have that problem.

  3. Shihpin Tseng reporter

    Emacs config file:

    (add-to-list 'load-path "~/.emacs.d/site-lisp/org-mode/lisp")
    (add-to-list 'load-path "~/.emacs.d/site-lisp/org-mode/contrib/lisp" t)
    
    (require 'org-loaddefs)
    
    (eval-after-load "org"
      '(progn
         (add-to-list 'org-modules 'org-drill)))
    
    (setq org-directory "~/org")
    

    a file contain only following content:

    *** Test List comprehensions                             :drill:
        :PROPERTIES:
        :ID:       60401DEB-97DE-4D1C-9ADE-73448F2B5958
        :END:
        ffffffffffffffffff
        #+BEGIN_SRC haskell
          [ (x, y) | x <- mx, y <- my ]
        #+END_SRC
    **** Answer
        aaaaaaaaaaaaaaaaaa
    

    $ /Applications/Emacs.app/Contents/MacOS/Emacs -nw -q --load ~/.emacs.d/init-org-mode.el

    After M-x org-drill the [ (x, y) | x <- mx, y <- my ] will be display as colored [...]

    Org-mode version 8.3beta (release_8.3beta-534-g588ec5 @ ~/.emacs.d/site-lisp/org-mode/lisp/)

  4. Shihpin Tseng reporter

    After emacs startup

    1. M-x `org-drill-directory', the brackets inside org source blocks will be treat as cloze marking

    2. Press `q' to quit org-drill

    3. M-x org-drill-resume the brackets will not be treat as cloze marking.

    And yes, I'm using latest org-mode and org-drill(2.4.5).

  5. Shihpin Tseng reporter

    config:

    (add-to-list 'load-path "~/.emacs.d/site-lisp/org-mode/lisp")
    (add-to-list 'load-path "~/.emacs.d/site-lisp/org-mode/contrib/lisp" t)
    
    (require 'org-loaddefs)
    
    (eval-after-load "org"
      '(progn
         (add-to-list 'org-modules 'org-drill)))
    
    (setq org-directory "~/org")
    

    org-mode file content:

    ** AAAAAAAAAAAA
       SCHEDULED: <2015-03-12 Thu>
       :PROPERTIES:
       :ID:       F8D71EEC-8B61-4A34-8727-8059E6CFED1C
       :DRILL_LAST_INTERVAL: 89.1157
       :DRILL_REPEATS_SINCE_FAIL: 5
       :DRILL_TOTAL_REPEATS: 4
       :DRILL_FAILURE_COUNT: 0
       :DRILL_AVERAGE_QUALITY: 4.75
       :DRILL_EASE: 2.8
       :DRILL_LAST_QUALITY: 5
       :DRILL_LAST_REVIEWED: [2014-12-13 Sat 19:14]
       :END:
       BBBBBBBBBBBBBBBB
    *** Answer
        CCCCCCCCCCCCCCCC
    
    ** Example List comprehensions                                        :drill:
       :PROPERTIES:
       :ID:       D6339149-4FD6-4A00-8081-FC6A0C7A5621
       :END:
       fffffff
       #+BEGIN_SRC haskell
         [ (x, y) | x <- mx, y <- my ]
       #+END_SRC
    **** Answer
         DDDDDDDDDDDDDDDDDDDDD
    

    C-x C-f open the org-mode file, M-x org-drill will reproduce this bug.

    Strangely, If delete the subtree of AAAAAAAAAAAA, the problem will gone.

    Tested on latest org-mode and Emacs 24.4.1.

  6. Paul Sexton repo owner

    Thanks, I was able to reproduce the bug using those files. The bug did not recur if I exited the drill session and then started another one, i.e. it seems to only occur the first time a drill session is run.

    I moved a line earlier in the source, and this fixed the problem for me. Can you try the new version in this repo and see if the problem is fixed?

    If it is not then see if running the drill session a second time gets around the problem.

    As an aside, there are some formatting problems in your snippet of a drill file above: the first item (AAAAAAAA) is not tagged with 'drill' and there is no 1st-level heading. Also the 'Answer' subheading for the second item is level 4 but it should be level 3 (currently it will not expand when the item is 'revealed' as it is not a direct child).

  7. Shihpin Tseng reporter

    I have tried 2.4.6, and the problem is still there. With the files I given above, the bug still occur the first time a drill session is run.

    However, my full emacs config don't have this problem this time, maybe that hook have been triggered some where. Any way, the minimal config should not occur the problem.

  8. Paul Sexton repo owner

    I'm going to assume the problem is in your emacs config as you suggest. There are many people who use org-drill with LaTeX or source code snippets and they have not reported this problem.

  9. Log in to comment