emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Bug: File mode specification error opening Org file without headline


From: N. Jackson
Subject: [O] 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

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 via email to

[Prev in Thread] Current Thread [Next in Thread]