Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

counsel-org-goto fails in the presence of empty headings #1422

Closed
drquicksilver opened this issue Jan 31, 2018 · 10 comments

Comments

@drquicksilver
Copy link

commented Jan 31, 2018

I've just installed ivy/counsel/swiper for the first time (version 0.10.0 from ELPA, using emacs 25.3.1)

Trying to use counsel-org-goto on my regular org files which are quite large (2-4 megabytes, tens of thousands of lines, thousands of org headings) just gives an error:

counsel-org-goto--add-face: Wrong type argument: stringp, nil

However opening rather small org files I have lying around which contain simple documents, presentations or whatever and it works perfectly. I haven't made any attempt to work out what property of the big files causes the issue but I'm very happy to do some digging if someone can point me towards what it might or might not be.

@basil-conto

This comment has been minimized.

Copy link
Collaborator

commented Jan 31, 2018

Can you please type M-xtoggle-debug-on-errorRET before the error occurs, and post the resulting error backtrace?

@drquicksilver

This comment has been minimized.

Copy link
Author

commented Jan 31, 2018

@drquicksilver

This comment has been minimized.

Copy link
Author

commented Jan 31, 2018

Managed to reproduce it. It's caused by empty headings. Here is a small example which consistently errors for me:

* a
* 
* b

Hope that helps!

@drquicksilver drquicksilver changed the title counsel-org-goto fails on large(?) files counsel-org-goto fails in the presence of empty headings Jan 31, 2018

@fabacino

This comment has been minimized.

Copy link
Contributor

commented Feb 1, 2018

I was not able to reproduce the issue with make plain and the org content mentioned above. The empty headings were passed as empty strings, not nil, into counsel-org-goto--add-face, which does not trigger any error.

@drquicksilver Can you reproduce the problem with make plain as well?

@drquicksilver

This comment has been minimized.

Copy link
Author

commented Feb 1, 2018

I will try make plain later when I have some time but quick note - the space after the asterisk is required to provoke the error. * on a line doesn't provoke it but *<SPC> does.

@basil-conto

This comment has been minimized.

Copy link
Collaborator

commented Feb 1, 2018

@drquicksilver @fabacino It may also be useful to establish which Org version everyone is using, given the package's propensity to breaking API changes.

I, for example, cannot reproduce the error with make plain and Org mode version 9.1.6 (9.1.6-33-g5b4a71-elpa @ /home/blc/.emacs.d/elpa/org-20180129/).

I have tried reproducing with the following buffer contents:

* foo
*
*\s
*\s\s
* bar

where \s stands for a space character as per Elisp syntax.

@fabacino

This comment has been minimized.

Copy link
Contributor

commented Feb 1, 2018

I was using Org mode version 9.1.3 (9.1.3-10-gadfbfd-elpa @ ~/.emacs.d/elpa/org-20171127/).

@drquicksilver

This comment has been minimized.

Copy link
Author

commented Feb 5, 2018

I appear to be using the ancient 8.2.10 which comes with emacs 25.1.

I'll install a more recent org-mode and report back.

@drquicksilver

This comment has been minimized.

Copy link
Author

commented Feb 5, 2018

I can confirm that with org-mode 9.1.6 I no longer see this error.

basil-conto added a commit to basil-conto/swiper that referenced this issue Feb 5, 2018
Support older Org versions for counsel-org-goto
The version of org-get-heading which ship with Emacs 24 and 25 can
return nil when its two arguments are non-nil.

counsel.el (counsel-org-goto--get-headlines): Handle this.

Fixes abo-abo#1422
@basil-conto

This comment has been minimized.

Copy link
Collaborator

commented Feb 5, 2018

@drquicksilver Thanks for checking. You'll probably be better suited by newer Org versions anyway, but as long as counsel supports Emacs versions as far back as 24 then it also ought to support Org versions as far back as 8.2.10, which which Emacs 24 shipped.

@abo-abo abo-abo closed this in #1431 Feb 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.