the-ted / org-mind-map

This is an emacs package that creates graphviz directed graphs.
GNU General Public License v3.0
542 stars 53 forks source link

Symbol’s value as variable is void: title #13

Closed novoid closed 7 years ago

novoid commented 7 years ago

When I setup org-mind-map (git clone from github, include in load-path, load with use-package + :loadpath) and invoke M-x org-mind-map-write I get: let*: Symbol’s value as variable is void: title and no PDF file is generated.

nocaoper commented 7 years ago

Found a temporary solution and proposed a pull request. Before the fix you can temporarily fix this yourself.

  1. go to your home directory type cd
  2. go to the place where your plugin was downloaded as for me cd .emacs.d/elpa/
  3. change directory to the org-mind-map plugin cd org-mind-map-20170912.1411
  4. disable the cached .elc by renaming org-mind-map.elc mv org-mind-map.elc old.elc
  5. apply the fix on the plugin main file which is org-mind-map.el replace "first x" by "nth 0 x" replace "first x" by "nth 1 x"
  6. save and reload emacs
  7. You're done!
andreasklostermaier commented 7 years ago

I can confirm, nocaoper's quick fix is working, but:

there is a typo in the replace-commands, they should read:

replace "first x" by "nth 0 x" replace "second x" by "nth 1 x"

novoid commented 7 years ago

No, this did not fix my issue.

I digged deeper and as far as I understand, the issue is here:

(defun org-mind-map-write-tags (h el)
  "Use H as the hash-map of colors and takes an element EL and extracts the title and tags.  Then, formats the titles and tags so as to be usable within DOT's graphviz language."
  (let* ((wrapped-title (org-mind-map-wrap-lines (org-element-property :title el)))
         (title (replace-regexp-in-string "&" "&" title nil t))
         (color (org-element-property :OMM-COLOR el))
[...]

The title used in the replace-regexp-in-string is not defined and therefore empty.

The corresponding line in the GitHub file looks different:

(title (replace-regexp-in-string "&" "&" wrapped-title nil t))

This is when I decided to update the whole repository to the current status.

After starting from scratch with the new version, I now get:

split-string: Wrong type argument: stringp, nil

I am not going to create a different issue for this.

andreasklostermaier commented 7 years ago

Do you get the error everytime you run org-mind-map, even on the very basic sample files?

I think, for analysis purposes, we should differ two cases:

  1. getting org-mind-map to compile a PDF at all (this did not work for me in the beginning, even with the super simple sample files, but was fixed with the patch of nocaoper).
  2. getting org-mind-map to compile every org-file (some of my org-files now compile correctly after the patch, some do not, with different error messages).

In the second case I just started to strip down the problematic files until I find the very line that causes the error. I found, for example, that a file crashes when there is an URL with trailing "/" at the end. I suppose, there are a couple of things that will crash a file, so there is some work ahead.

But the simple files should work by now!

nocaoper commented 7 years ago

Oh shout thanks for pointing that out! I did made a mistake when trying to define first and second.

novoid commented 7 years ago

I can confirm that example-1.org.pdf and example-1.org.pdf get generated.

So it seems to be an issue with my rather large Org-mode files.

I got issues when generating the mind-map only for the current sub-tree of the current org-mode file. In those cases, additional buffers gets opened with paths that look like URLs I included in my Org-mode file. Same holds when I use org-mind-map-write-current-tree even when the URL is in a separate tree. So there is something strange going on.

nocaoper commented 7 years ago

Does the issue raise an error, if yes it would be interesting to include a small demo file as reference :). I used M-x toggle-debug-on-error to rapidly close on the fix.

novoid commented 7 years ago

Here you are:

# -*- mode: org; coding: utf-8; -*-
* heading 1

* Heading 2

* Heading 3

- [[http://www.iso27001security.com/][ISO27k infosec management standards]]

** Sub-heading 3a
andreasklostermaier commented 7 years ago

@novoid: Ah, this is exactly the problem with the trailing "/", for which I opened new issue #15 !

Remove the trailing "/" after http://www.iso27001security.com/ and the file should work.

novoid commented 7 years ago

Okay, I'll wait for this fix. Thanks for your help!