Hi, can you confirm the issue only appears when the first line of the buffer isn't an outline heading? I think it's easy enough to fix then, and if you like you might want to try the patch I've attached.
It's bugged me for a while that `org-back-to-heading' et al throw errors when they're used before the first heading, but I haven't really come up with a better solution. On 8/18/15, Andreas Leha <andreas.l...@med.uni-goettingen.de> wrote: > Hi Bastien, > > Bastien <b...@gnu.org> writes: >> Hi Andreas, >> >> Andreas Leha <andreas.l...@med.uni-goettingen.de> writes: >> >>> For quite some time now, I have to disable outshine/outorg [1] as it >>> does give me "Before first heading" (complete backtrace [2]) whenever I >>> open an org file followed by more issues actually using org mode. >> >> Copying Thorsten as the author of outshine.el, hopefully he's be able >> to dig deeper. > > Thanks, but my hopes are low. Quoting from the top of outshine's github > readme [1]: > > ,---- > | events in my life forced me away from Emacs and [...] I won't have the > | time to fix issues or code new features (though I will apply patches) > `---- > > Regards, > Andreas > > [1] https://github.com/tj64/outshine > > >
From 753f4e2723c493274d9e55c195296fe5d0b5773e Mon Sep 17 00:00:00 2001 From: Philip <pip...@gmail.com> Date: Tue, 18 Aug 2015 20:24:13 +0000 Subject: [PATCH] Avoid error when first line of the buffer isn't a heading. * outshine.el (outline-hide-sublevels): Avoid error for files that don't begin with a heading. (outline-cycle): Avoid error for files that don't begin with a heading. --- outshine.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/outshine.el b/outshine.el index 9ccbd1f..aba5271 100644 --- a/outshine.el +++ b/outshine.el @@ -1826,8 +1826,9 @@ The old value is stored in (setq keep-levels (1- keep-levels)) (save-excursion (goto-char (point-min)) - (hide-subtree) - (show-children keep-levels) + (when (outline-on-heading-p) + (hide-subtree) + (show-children keep-levels)) (condition-case err (while (outline-get-next-sibling) (hide-subtree) @@ -2048,7 +2049,8 @@ may have changed." (message "SUBTREE"))) (t ;; Default action: hide the subtree. - (hide-subtree) + (when (outline-on-heading-p) + (hide-subtree)) (unless outshine-cycle-silently (message "FOLDED")))))) -- 2.5.0