3

I have run into an error with latest version of org-mode and cannot seem to find how to track it down. I have reported the issue on the org mail list, but so far the only response indicates they could not reproduce the issue.

So far I have tried the following

  1. Ensured it is not a mixed version issue. A common org problem occurs when you try to install a new version, but some of the old version has already been loaded. I used all the standard techniques to avoid this problem and even deleted the version of org which comes with emacs 25. So I'm pretty sure it is not a mixed version problem.

  2. I have tried with both emacs 25.1 and emacs 25.2-rc2. Same issue

  3. I have tried using different accounts (same desktop) - one of which was a completely fresh account.

  4. I've check for load-file shadows, but all looks correct.

  5. I get the same issue with both the org and org-plus-contgrib packages

  6. I also tried the org package in elpa (which is same version as the one in the org archive).

  7. I have downloaded and built the package from sources.

  8. I have tried opening an org file without source blocks, which is fine, but then when I open the first one with a source block, I get the error.

  9. I have tried org-reload with and without the arg to load from *.el before opening the org file with source blocks and it makes no difference.

The error only occurs when I am also loading the goto-address-prog-mode mode (part of goto-addr package in emacs).

When you first visit an org file with a src_block, you get the error org-mode fontificaiton error at line x. It doesn't seem to matter what the src-block type is i.e. emacs-lisp or sh both give the same error. The code in the sr block is not fontified.

If you then kill the buffer and then re-open the org file a second time, it loads fine - no errors and src blocks are fontified.

This makes me suspect that org is loading something, but is not loading it until after it has loaded the org file - possibly goto-address-prog-mode is holding things up. However, I cannot work out how to generate a stacktrace. Setting debug-on-error has no effect.

I have been using the goto-address-prog-mode with org for some time and only noticed this problem when updating most recent version from org repo.

Ideas? Suggestions? How can I dig into this to find out what the problem is? How can I get a debug backtrace? Can anyone else reproduce this issue?

The minimal init.el file I use to reproduce this problem is below. I ensure there is nothing in my .emacs.d/elpa directory (in fact, I delete it before starting).

(require 'package)

(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
(package-initialize)

(unless (package-installed-p 'org-plus-contrib)
  (package-refresh-contents)
  (package-install 'org-plus-contrib))

(require 'org)

(require 'goto-addr)

(add-hook 'prog-mode-hook 'goto-address-prog-mode)

and the test org file I use is

* Test
  This is a test of fontification in org files which contain source blocks

  First, we test an sh block

  #+BEGIN_SRC sh
    echo "Hello world"
  #+END_SRC

  Next, a simple emacs lisp source block

  #+BEGIN_SRC emacs-lisp
    ;; A simple test
    (message "A Test")
  #+END_SRC

and I start emacs with

emacs -Q -l .emacs.d/init.el --debug-init
  • I have the same problem with 25.1, Spacemacs loaded. It doesn't matter if I delete and reload the org buffer, nor what language the source block is. – E Bro Feb 28 '17 at 14:37
3

I can reproduce this with a "more-minimal" example:

Run emacs -Q, then evaluate the following:

(require 'package)
(setq package-load-list
      '((org-plus-contrib t)))
(package-initialize)

(add-hook 'prog-mode-hook 'goto-address-prog-mode)

The error you describe appears on first loading your test org file, but not if I close and re-open it. Further, it only occurs with the addition of the goto-address-prog-mode hook.

The fact that it only comes up on the first load of the org file suggests there is a problem with code not getting loaded in the correct order or at the correct time. The fact that I can reproduce this with such a minimal example suggests it's a true bug, and not a misconfiguration on your part. I would report this as a bug to org-mode and/or emacs.

  • Thanks. Just one question, with your more minimal init, where/how does emacs get the org-plus-contrib package? I had to add the org package archive – Tim X Feb 27 '17 at 21:36
  • This assumes the package is already installed in your ~/.emacs.d/elpa/. The (setq package-load-list ...) form insures that only org-plus-contrib is loaded, no other packages. – Tyler Feb 27 '17 at 21:47
  • OK, thanks. I have reported to org mail list, but one of the org maintainers was unable to reproduce the issue, so having some problems gaining traction there. – Tim X Feb 27 '17 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.