From mboxrd@z Thu Jan 1 00:00:00 1970 From: nljlistbox2@gmail.com (N. Jackson) 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 Message-ID: <87r3dzzyds.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1at0z8-0004fP-Q2 for emacs-orgmode@gnu.org; Wed, 20 Apr 2016 18:52:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1at0z5-0002gg-FW for emacs-orgmode@gnu.org; Wed, 20 Apr 2016 18:52:38 -0400 Received: from mail-io0-x231.google.com ([2607:f8b0:4001:c06::231]:35330) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1at0z5-0002gV-8r for emacs-orgmode@gnu.org; Wed, 20 Apr 2016 18:52:35 -0400 Received: by mail-io0-x231.google.com with SMTP id g185so68403089ioa.2 for ; Wed, 20 Apr 2016 15:52:34 -0700 (PDT) Received: from moondust.nodomain.none (blk-30-139-186.eastlink.ca. [96.30.139.186]) by smtp.gmail.com with ESMTPSA id j72sm114213ioj.30.2016.04.20.15.52.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Apr 2016 15:52:33 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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=20 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-s= ubtree) (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(# "~/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: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (setq org-export-backends '(ascii beamer html icalendar latex odt) org-tab-first-hook '(org-hide-block-toggle-maybe org-babel-hide-result-tog= gle-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-co= mmand-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 =E2=80=93 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 =E2=80=93 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 =E2=80=93 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 "\\" org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-confi= gure-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-lo= ck #[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) )