emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: nljlistbox2@gmail.com (N. Jackson)
To: emacs-orgmode@gnu.org
Subject: Bug: File mode specification error opening Org file without headline on first line [8.3.4 (8.3.4-39-ge0acd8-elpa @ /home/nlj/.emacs.d/elpa/org-20160418/)]
Date: Wed, 20 Apr 2016 19:52:31 -0300	[thread overview]
Message-ID: <87r3dzzyds.fsf@gmail.com> (raw)


For several months now I have been getting the error "File mode
specification error: (error Before first heading)" when I open some of
my Org files. [After the error message, the file opens just fine and Org
works normally.]

What distinguishes the Org files that do not suffer from this problem
from those that do is that they have a headline in the first line of
the file.

A fairly minimal recipe:

    1. $ cat > ~/temp-org-test.org
    An introduction.

    * A Headline 

      Some text.

    ** Sub-Topic 1

    ** Sub-Topic 2

    *** Additional entry
    ^D

    2. $ emacs &

    3. Visit ~/temp-org-test.org

At this point the error message "File mode specification error: (error
Before first heading)" is displayed.

Note: This test file is from
http://orgmode.org/worg/dev/org-syntax.html.

Setting debug-on-error, I get the following backtrace:

    Debugger entered--Lisp error: (error "Before first heading")
      signal(error ("Before first heading"))
      error("Before first heading")
      outline-back-to-heading()
      outline-flag-subtree(t)
      hide-subtree()
      (save-excursion (goto-char (point-min)) (hide-subtree) (show-children keep-levels) (condition-case err (while (outline-get-next-sibling) (hide-subtree) (show-children keep-levels)) (error nil)))
      outline-hide-sublevels(1)
      org-overview()
      org-content()
      org-set-startup-visibility()
      org-mode()
      set-auto-mode-0(org-mode nil)
      set-auto-mode()
      normal-mode(t)
      after-find-file(nil t)
      find-file-noselect-1(#<buffer temp-org-test.org> "~/temp-org-test.org" nil nil "~/temp-org-test.org" (801256 64773))
      find-file-noselect("/home/nlj/temp-org-test.org" nil nil nil)
      find-file("/home/nlj/temp-org-test.org")

On the other hand, if I edit the test file and add a headline on the
first line of the file, for example

    * COMMENT This is dummy headline

then the error does not occur. Of course, this seems a rather ugly
work-around.


Emacs  : GNU Emacs 25.0.92.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
 of 2016-04-18
Package: Org-mode version 8.3.4 (8.3.4-39-ge0acd8-elpa @ /home/nlj/.emacs.d/elpa/org-20160418/)

current state:
==============
(setq
 org-export-backends '(ascii beamer html icalendar latex odt)
 org-tab-first-hook '(org-hide-block-toggle-maybe org-babel-hide-result-toggle-maybe
		      org-babel-header-arg-expand)
 outline-minor-mode-hook '(outshine-hook-function)
 org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook)
 org-reverse-note-order t
 org-occur-hook '(org-first-headline-recenter)
 org-checkbox-hierarchical-statistics nil
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-agenda-start-on-weekday nil
 org-log-done t
 org-format-latex-options '(:foreground default :background default :scale 1.5
			    :html-foreground "Black" :html-background "Transparent"
			    :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))
 org-confirm-shell-link-function 'yes-or-no-p
 org-finalize-agenda-hook '(nlj-agenda-to-appt)
 org-startup-folded 'content
 org-file-apps '((auto-mode . emacs) ("\\.mm\\'" . default) ("\\.x?html?\\'" . default)
		 ("\\.pdf\\'" . "evince %s"))
 org-agenda-skip-scheduled-if-done t
 org-support-shift-select 'always
 org-default-notes-file "/data/org//notes.org"
 org-capture-templates '(("t" "Todo" entry
			  (file+headline (concat org-directory "/organiser.org") "Todos")
			  "* TODO %?\n:LOGBOOK:\n  CREATED: %U\n:END:\n%i\n" :prepend t
			  :kill-buffer t :empty-lines 1)
			 ("e" "Event" entry
			  (file+headline (concat org-directory "/organiser.org") "Events")
			  "* %?\n:LOGBOOK:\n  CREATED: %U\n:END:\n%i\n" :kill-buffer t
			  :empty-lines 1)
			 ("a" "Appointment" entry
			  (file+headline (concat org-directory "/organiser.org")
			   "Appointments")
			  "* APPT %?\n:LOGBOOK:\n  CREATED: %U\n:END:\n%i\n" :kill-buffer t
			  :empty-lines 1)
			 ("l" "Log" plain (file (concat org-directory "/log.org"))
			  "* %U\n\n%?\n%i\n" :kill-buffer t :empty-lines 1 :clock-in t
			  :clock-resume t)
			 ("n" "Note" entry
			  (file+headline (concat org-directory "/notes.org") "Notes")
			  "* %^{Enter Note Title}    %^g\n   :PROPERTIES:\n   :Created:  %U\n   :END:\n\n%?\n%i\n" :kill-buffer t :empty-lines 1 :clock-in t :clock-resume t)
			 ("o" "Old-style Dated Note" entry
			  (file+headline (concat org-directory "/notes.org") "Dated Notes")
			  "* %U\n%?\n%i\n" :kill-buffer t :empty-lines 1 :clock-in t
			  :clock-resume t)
			 ("j" "Journal" entry
			  (file+datetree (concat org-directory "/journal.org"))
			  "* %U\n%?\n%i\n" :kill-buffer t :empty-lines 1 :clock-in t
			  :clock-resume t)
			 ("w" "Work caputres")
			 ("wt" "Work – Miscellaneous Todo" entry
			  (file+headline (concat org-directory "/work.org")
			   "Miscellaneous Tasks")
			  "* TODO %?\n:LOGBOOK:\n  CREATED: %U\n:END:\n%i\n" :prepend t
			  :kill-buffer t :empty-lines 1 :clock-in t :clock-resume t)
			 ("wm" "Work – Meeting Appointment" entry
			  (file+headline (concat org-directory "/work.org") "Meetings")
			  "* MTNG %?\n:LOGBOOK:\n  CREATED: %U\n:END:\n%i\n" :kill-buffer t
			  :empty-lines 1 :clock-in t :clock-resume t)
			 ("wn" "Work – Note" entry
			  (file+headline (concat org-directory "/work.org") "Notes")
			  "* %U\n%?\n%i\n" :kill-buffer t :empty-lines 1 :clock-in t
			  :clock-resume t)
			 ("c" "Capture" plain (file (concat org-directory "/notes.org"))
			  "%U\n Context: %a\nCapture: %i\nComments: %?\n" :prepend t
			  :kill-buffer t :empty-lines 1)
			 )
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-from-is-user-regexp "\\<REDACTED\\>"
 org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(navi-make-org-mode-promotion-headings-list turn-on-font-lock
		 #[nil "\300\301\302\303\304$\207"
		   [org-add-hook change-major-mode-hook org-show-block-all append local] 5]
		 #[nil "\300\301\302\303\304$\207"
		   [org-add-hook change-major-mode-hook org-babel-show-result-all append
		    local]
		   5]
		 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-refile-targets '((org-agenda-files :maxlevel . 5))
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-replace-disputed-keys t
 org-clock-persist t
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
 org-directory "/data/org/"
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
		  org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-agenda-finalize-hook '(nlj-agenda-to-appt)
 org-agenda-ndays 7
 org-catch-invisible-edits 'show
 org-deadline-warning-days 21
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-log-into-drawer t
 org-contacts-icon-use-gravatar nil
 org-agenda-skip-deadline-if-done t
 org-hierarchical-todo-statistics nil
 org-agenda-files '("/data/org/contacts.org" "REDACTED"
		    "/data/org//organiser.org" "/data/org//log-and-centre.org"
		    "/data/org//log.org" "/data/org//journal.org"
		    "/data/org//roles-and-goals.org" "/data/org//org-usage-notes.org")
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-archive-save-context-info '(time file category todo itags olpath ltags)
 )

             reply	other threads:[~2016-04-20 22:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20 22:52 N. Jackson [this message]
2016-04-21  1:41 ` Bug: File mode specification error opening Org file without headline on first line [8.3.4 (8.3.4-39-ge0acd8-elpa @ /home/nlj/.emacs.d/elpa/org-20160418/)] Kyle Meyer
2016-04-21 12:00   ` N. Jackson

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=87r3dzzyds.fsf@gmail.com \
    --to=nljlistbox2@gmail.com \
    --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).