emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: Andreas Leha <andreas.leha@med.uni-goettingen.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: outorg issue
Date: Tue, 18 Aug 2015 20:35:28 +0000	[thread overview]
Message-ID: <CAOqdjBe2vvm5R5U1mBLycChUETV9kQ6Ft4Dt-vqiyci5HHf2aA@mail.gmail.com> (raw)
In-Reply-To: <oluk2ss5q6f.fsf@med.uni-goettingen.de>

[-- Attachment #1: Type: text/plain, Size: 1216 bytes --]

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.leha@med.uni-goettingen.de> wrote:
> Hi Bastien,
>
> Bastien <bzg@gnu.org> writes:
>> Hi Andreas,
>>
>> Andreas Leha <andreas.leha@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
>
>
>

[-- Attachment #2: 0001-Avoid-error-when-first-line-of-the-buffer-isn-t-a-he.patch --]
[-- Type: text/x-patch, Size: 1270 bytes --]

From 753f4e2723c493274d9e55c195296fe5d0b5773e Mon Sep 17 00:00:00 2001
From: Philip <pipcet@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


  parent reply	other threads:[~2015-08-18 20:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 21:51 outorg issue Andreas Leha
2015-08-13 14:30 ` John Kitchin
2015-08-13 14:37   ` Andreas Leha
2015-08-18 16:28 ` Bastien
2015-08-18 19:53   ` Andreas Leha
2015-08-18 20:11     ` Kaushal
2015-08-18 22:26       ` Bastien
2015-08-19  7:53       ` Andreas Leha
2015-08-18 20:35     ` Pip Cet [this message]
2015-08-19  8:10       ` Andreas Leha
2015-08-19 14:23         ` Pip Cet
2015-08-19 19:08           ` Kaushal
2015-09-08 20:09             ` Thorsten Jolitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOqdjBe2vvm5R5U1mBLycChUETV9kQ6Ft4Dt-vqiyci5HHf2aA@mail.gmail.com \
    --to=pipcet@gmail.com \
    --cc=andreas.leha@med.uni-goettingen.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).