In case I try to reschedule a date from the weekly agenda view I get the following backtrace; I am under the impression, that this seems not to be the bug, which I have tried to describe in the last message, but at least it shows, that something is wrong (with my setup/emacs/org?)

----------------------------8<-----------------------------------------
Debugger entered--Lisp error: (error "Before first headline at position 1 in buffer date.org")
  signal(error ("Before first headline at position 1 in buffer date.org"))
error("Before first headline at position %d in buffer %s" 1 #<buffer date.org>) (condition-case nil (outline-back-to-heading invisible-ok) (error (error "Before first headline at position %d in buffer %s" (point) (current-buffer))))
  org-back-to-heading(t)
(...)
----------------------------8<-----------------------------------------

(I post the full backtrace message as txt-attachment).

Thanks
Martin


Am 20.09.2013 21:12, schrieb G. Martin Butz:
Hi,

I tried to describe this error a while ago, but did not get any response
- probably due to the fact, that I can not find out, how to securely
reproduce this very annoying behaviour; I will try to describe:

1. I try to reschedule an entry (C-c C-s)
2. The buffer with the org file seems to be replaced by a calendar
3. Futhermore 2 additional buffers appear with the calendar in it
4. If can not assign a date meaning cursor movement (Shift Left/Right)
seems to be random e.g. skipping a few day and also going in the wrong
direction (e.g. left means right)
5. If I try quitting emacs, I am asked if I want to save the original
org-mode buffer (in which I tried to reschedule a date)
6. If I dare to do this, emacs will write the calender into this buffer
thereby erasing the original org mode file.

I tried to deliver a backtrace (load org-mode and activate the debugger
according to [1]) but: There is no error message at all (!sic)!

The only thing I could do is to make a screenshot showing state no. 3 [2].

This makes keeping track of dates in org-mode almost unusable for me.
Does anyone have an idea, what I could do to pinpoint this behaviour?

I am running org-mode 8.2 (updated today, but have had this error since
a while) on emacs 24.3.1 on Linux Crunchbang Waldorf.

Thanks for any hints and thanks alot for wonderful org-mode in general
Martin

[1] <http://orgmode.org/manual/Feedback.html>
[2] <http://www.mkblog.org/download/emacs-org-mode-calendar.png>


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| G. Martin Butz, m...@mkblog.org, 0421 98749324, www.mkblog.org |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Debugger entered--Lisp error: (error "Before first headline at position 1 in 
buffer date.org")
  signal(error ("Before first headline at position 1 in buffer date.org"))
  error("Before first headline at position %d in buffer %s" 1 #<buffer 
date.org>)
  (condition-case nil (outline-back-to-heading invisible-ok) (error (error 
"Before first headline at position %d in buffer %s" (point) (current-buffer))))
  org-back-to-heading(t)
  (let (col list elt ts buffer-invisibility-spec) (org-back-to-heading t) 
(looking-at (concat org-outline-regexp "\\( *\\)[^
\n]*")) (goto-char (match-end 1)) (setq col (current-column)) (goto-char 
(match-end 0)) (if (eobp) (insert "\n") (forward-char 1)) (if (and (not what) 
(not (looking-at (concat "[      ]*" org-keyword-time-not-clock-regexp)))) 
(progn (throw (quote exit) nil))) (if (and (not (looking-at 
org-outline-regexp)) (looking-at (concat "[^
\n]*?" org-keyword-time-regexp "[^
\n]*")) (not (equal (match-string 1) org-clock-string))) (narrow-to-region 
(match-beginning 0) (match-end 0)) (insert-before-markers "\n") (backward-char 
1) (narrow-to-region (point) (point)) (and org-adapt-indentation 
(org-indent-to-column col))) (setq list (cons what remove)) (while list (setq 
elt (car (prog1 list (setq list (cdr list))))) (if (or (and (eq elt (quote 
scheduled)) (re-search-forward org-scheduled-time-regexp nil t)) (and (eq elt 
(quote deadline)) (re-search-forward org-deadline-time-regexp nil t)) (and (eq 
elt (quote closed)) (re-search-forward org-closed-time-regexp nil t))) (progn 
(replace-match "") (if (looking-at "--+<[^>]+>") (replace-match ""))))) (and 
(looking-at "[      ]+") (replace-match "")) (and org-adapt-indentation (bolp) 
(org-indent-to-column col)) (if what (progn (insert (if (not (or (bolp) (eq ... 
32))) " " "") (cond ((eq what (quote scheduled)) org-scheduled-string) ((eq 
what (quote deadline)) org-deadline-string) ((eq what (quote closed)) 
org-closed-string)) " ") (setq ts (org-insert-time-stamp time (or 
org-time-was-given (and (eq what ...) org-log-done-with-time)) (eq what (quote 
closed)) nil nil (list org-end-time-was-given))) (insert (if (not (or (bolp) 
(eq ... 32) (memq ... ...) (eobp))) " " "")) (end-of-line 1))) (goto-char 
(point-min)) (widen) (if (and (looking-at "[       ]*\n") (equal (char-before) 
10)) (delete-region (1- (point)) (point-at-eol))) ts)
  (save-restriction (let (col list elt ts buffer-invisibility-spec) 
(org-back-to-heading t) (looking-at (concat org-outline-regexp "\\( *\\)[^
\n]*")) (goto-char (match-end 1)) (setq col (current-column)) (goto-char 
(match-end 0)) (if (eobp) (insert "\n") (forward-char 1)) (if (and (not what) 
(not (looking-at (concat "[      ]*" org-keyword-time-not-clock-regexp)))) 
(progn (throw (quote exit) nil))) (if (and (not (looking-at 
org-outline-regexp)) (looking-at (concat "[^
\n]*?" org-keyword-time-regexp "[^
\n]*")) (not (equal (match-string 1) org-clock-string))) (narrow-to-region 
(match-beginning 0) (match-end 0)) (insert-before-markers "\n") (backward-char 
1) (narrow-to-region (point) (point)) (and org-adapt-indentation 
(org-indent-to-column col))) (setq list (cons what remove)) (while list (setq 
elt (car (prog1 list (setq list (cdr list))))) (if (or (and (eq elt (quote 
scheduled)) (re-search-forward org-scheduled-time-regexp nil t)) (and (eq elt 
(quote deadline)) (re-search-forward org-deadline-time-regexp nil t)) (and (eq 
elt (quote closed)) (re-search-forward org-closed-time-regexp nil t))) (progn 
(replace-match "") (if (looking-at "--+<[^>]+>") (replace-match ""))))) (and 
(looking-at "[      ]+") (replace-match "")) (and org-adapt-indentation (bolp) 
(org-indent-to-column col)) (if what (progn (insert (if (not (or ... ...)) " " 
"") (cond ((eq what ...) org-scheduled-string) ((eq what ...) 
org-deadline-string) ((eq what ...) org-closed-string)) " ") (setq ts 
(org-insert-time-stamp time (or org-time-was-given (and ... 
org-log-done-with-time)) (eq what (quote closed)) nil nil (list 
org-end-time-was-given))) (insert (if (not (or ... ... ... ...)) " " "")) 
(end-of-line 1))) (goto-char (point-min)) (widen) (if (and (looking-at "[   
]*\n") (equal (char-before) 10)) (delete-region (1- (point)) (point-at-eol))) 
ts))
  (save-excursion (save-restriction (let (col list elt ts 
buffer-invisibility-spec) (org-back-to-heading t) (looking-at (concat 
org-outline-regexp "\\( *\\)[^
\n]*")) (goto-char (match-end 1)) (setq col (current-column)) (goto-char 
(match-end 0)) (if (eobp) (insert "\n") (forward-char 1)) (if (and (not what) 
(not (looking-at (concat "[      ]*" org-keyword-time-not-clock-regexp)))) 
(progn (throw (quote exit) nil))) (if (and (not (looking-at 
org-outline-regexp)) (looking-at (concat "[^
\n]*?" org-keyword-time-regexp "[^
\n]*")) (not (equal (match-string 1) org-clock-string))) (narrow-to-region 
(match-beginning 0) (match-end 0)) (insert-before-markers "\n") (backward-char 
1) (narrow-to-region (point) (point)) (and org-adapt-indentation 
(org-indent-to-column col))) (setq list (cons what remove)) (while list (setq 
elt (car (prog1 list (setq list ...)))) (if (or (and (eq elt ...) 
(re-search-forward org-scheduled-time-regexp nil t)) (and (eq elt ...) 
(re-search-forward org-deadline-time-regexp nil t)) (and (eq elt ...) 
(re-search-forward org-closed-time-regexp nil t))) (progn (replace-match "") 
(if (looking-at "--+<[^>]+>") (replace-match ""))))) (and (looking-at "[   ]+") 
(replace-match "")) (and org-adapt-indentation (bolp) (org-indent-to-column 
col)) (if what (progn (insert (if (not ...) " " "") (cond (... 
org-scheduled-string) (... org-deadline-string) (... org-closed-string)) " ") 
(setq ts (org-insert-time-stamp time (or org-time-was-given ...) (eq what ...) 
nil nil (list org-end-time-was-given))) (insert (if (not ...) " " "")) 
(end-of-line 1))) (goto-char (point-min)) (widen) (if (and (looking-at "[   
]*\n") (equal (char-before) 10)) (delete-region (1- (point)) (point-at-eol))) 
ts)))
  (catch (quote exit) (if (and (memq what (quote (scheduled deadline))) (or 
(not time) (and (stringp time) (string-match "^[-+]+[0-9]" time)))) (progn 
(save-excursion (org-back-to-heading t) (setq end (save-excursion 
(outline-next-heading) (point))) (if (re-search-forward (if (eq what ...) 
org-scheduled-time-regexp org-deadline-time-regexp) end t) (progn (setq ts 
(match-string 1) default-time (apply ... ...) default-input (and ts ...))))))) 
(if what (progn (setq time (if (stringp time) (apply (quote encode-time) 
(org-read-date-analyze time default-time (decode-time default-time))) (or time 
(org-read-date nil (quote to-time) nil nil default-time default-input)))))) (if 
(and org-insert-labeled-timestamps-at-point (member what (quote (scheduled 
deadline)))) (progn (insert (if (eq what (quote scheduled)) 
org-scheduled-string org-deadline-string) " ") (org-insert-time-stamp time 
org-time-was-given nil nil nil (list org-end-time-was-given)) (setq what nil))) 
(save-excursion (save-restriction (let (col list elt ts 
buffer-invisibility-spec) (org-back-to-heading t) (looking-at (concat 
org-outline-regexp "\\( *\\)[^
\n]*")) (goto-char (match-end 1)) (setq col (current-column)) (goto-char 
(match-end 0)) (if (eobp) (insert "\n") (forward-char 1)) (if (and (not what) 
(not (looking-at ...))) (progn (throw (quote exit) nil))) (if (and (not 
(looking-at org-outline-regexp)) (looking-at (concat "[^
\n]*?" org-keyword-time-regexp "[^
\n]*")) (not (equal ... org-clock-string))) (narrow-to-region (match-beginning 
0) (match-end 0)) (insert-before-markers "\n") (backward-char 1) 
(narrow-to-region (point) (point)) (and org-adapt-indentation 
(org-indent-to-column col))) (setq list (cons what remove)) (while list (setq 
elt (car (prog1 list ...))) (if (or (and ... ...) (and ... ...) (and ... ...)) 
(progn (replace-match "") (if ... ...)))) (and (looking-at "[        ]+") 
(replace-match "")) (and org-adapt-indentation (bolp) (org-indent-to-column 
col)) (if what (progn (insert (if ... " " "") (cond ... ... ...) " ") (setq ts 
(org-insert-time-stamp time ... ... nil nil ...)) (insert (if ... " " "")) 
(end-of-line 1))) (goto-char (point-min)) (widen) (if (and (looking-at "[    
]*\n") (equal (char-before) 10)) (delete-region (1- (point)) (point-at-eol))) 
ts))))
  (let (org-time-was-given org-end-time-was-given ts end default-time 
default-input) (catch (quote exit) (if (and (memq what (quote (scheduled 
deadline))) (or (not time) (and (stringp time) (string-match "^[-+]+[0-9]" 
time)))) (progn (save-excursion (org-back-to-heading t) (setq end 
(save-excursion (outline-next-heading) (point))) (if (re-search-forward (if ... 
org-scheduled-time-regexp org-deadline-time-regexp) end t) (progn (setq ts ... 
default-time ... default-input ...)))))) (if what (progn (setq time (if 
(stringp time) (apply (quote encode-time) (org-read-date-analyze time 
default-time ...)) (or time (org-read-date nil ... nil nil default-time 
default-input)))))) (if (and org-insert-labeled-timestamps-at-point (member 
what (quote (scheduled deadline)))) (progn (insert (if (eq what (quote 
scheduled)) org-scheduled-string org-deadline-string) " ") 
(org-insert-time-stamp time org-time-was-given nil nil nil (list 
org-end-time-was-given)) (setq what nil))) (save-excursion (save-restriction 
(let (col list elt ts buffer-invisibility-spec) (org-back-to-heading t) 
(looking-at (concat org-outline-regexp "\\( *\\)[^
\n]*")) (goto-char (match-end 1)) (setq col (current-column)) (goto-char 
(match-end 0)) (if (eobp) (insert "\n") (forward-char 1)) (if (and (not what) 
(not ...)) (progn (throw ... nil))) (if (and (not ...) (looking-at ...) (not 
...)) (narrow-to-region (match-beginning 0) (match-end 0)) 
(insert-before-markers "\n") (backward-char 1) (narrow-to-region (point) 
(point)) (and org-adapt-indentation (org-indent-to-column col))) (setq list 
(cons what remove)) (while list (setq elt (car ...)) (if (or ... ... ...) 
(progn ... ...))) (and (looking-at "[     ]+") (replace-match "")) (and 
org-adapt-indentation (bolp) (org-indent-to-column col)) (if what (progn 
(insert ... ... " ") (setq ts ...) (insert ...) (end-of-line 1))) (goto-char 
(point-min)) (widen) (if (and (looking-at "[        ]*\n") (equal ... 10)) 
(delete-region (1- ...) (point-at-eol))) ts)))))
  org-add-planning-info(scheduled nil closed)
  (cond ((equal arg (quote (4))) (progn (if (and old-date org-log-reschedule) 
(progn (org-add-log-setup (quote delschedule) nil old-date (quote findpos) 
org-log-reschedule))) (org-remove-timestamp-with-keyword org-scheduled-string) 
(message "Item is no longer scheduled."))) ((equal arg (quote (16))) 
(save-excursion (if (re-search-forward org-scheduled-time-regexp 
(save-excursion (outline-next-heading) (point)) t) (let* ((rpl0 (match-string 
1)) (rpl (replace-regexp-in-string " -[0-9]+[hdwmy]" "" rpl0))) (replace-match 
(concat org-scheduled-string " <" rpl (format " -%dd" ...) ">") t t)) 
(user-error "No scheduled information to update")))) (t (org-add-planning-info 
(quote scheduled) time (quote closed)) (if (and old-date org-log-reschedule 
(not (equal old-date (substring org-last-inserted-timestamp 1 -1)))) (progn 
(org-add-log-setup (quote reschedule) nil old-date (quote findpos) 
org-log-reschedule))) (if repeater (progn (save-excursion (org-back-to-heading 
t) (if (re-search-forward (concat org-scheduled-string " " 
org-last-inserted-timestamp) (save-excursion ... ...) t) (progn (goto-char ...) 
(insert " " repeater) (setq org-last-inserted-timestamp ...)))))) (message 
"Scheduled to %s" org-last-inserted-timestamp)))
  (let* ((old-date (org-entry-get nil "SCHEDULED")) (old-date-time (if old-date 
(org-time-string-to-time old-date))) (repeater (and old-date (string-match 
"\\([.+-]+[0-9]+[hdwmy]\\(?:[/ ][-+]?[0-9]+[hdwmy]\\)?\\) ?" old-date) 
(match-string 1 old-date)))) (cond ((equal arg (quote (4))) (progn (if (and 
old-date org-log-reschedule) (progn (org-add-log-setup (quote delschedule) nil 
old-date (quote findpos) org-log-reschedule))) 
(org-remove-timestamp-with-keyword org-scheduled-string) (message "Item is no 
longer scheduled."))) ((equal arg (quote (16))) (save-excursion (if 
(re-search-forward org-scheduled-time-regexp (save-excursion 
(outline-next-heading) (point)) t) (let* ((rpl0 ...) (rpl ...)) (replace-match 
(concat org-scheduled-string " <" rpl ... ">") t t)) (user-error "No scheduled 
information to update")))) (t (org-add-planning-info (quote scheduled) time 
(quote closed)) (if (and old-date org-log-reschedule (not (equal old-date 
(substring org-last-inserted-timestamp 1 -1)))) (progn (org-add-log-setup 
(quote reschedule) nil old-date (quote findpos) org-log-reschedule))) (if 
repeater (progn (save-excursion (org-back-to-heading t) (if (re-search-forward 
... ... t) (progn ... ... ...))))) (message "Scheduled to %s" 
org-last-inserted-timestamp))))
  (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) (let 
((cl (if (eq org-loop-over-headlines-in-active-region (quote start-level)) 
(quote region-start-level) (quote region))) 
org-loop-over-headlines-in-active-region) (org-map-entries (list (quote 
org-schedule) (list (quote quote) arg) time) 
org-loop-over-headlines-in-active-region cl (if (outline-invisible-p) 
(org-end-of-subtree nil t)))) (let* ((old-date (org-entry-get nil "SCHEDULED")) 
(old-date-time (if old-date (org-time-string-to-time old-date))) (repeater (and 
old-date (string-match "\\([.+-]+[0-9]+[hdwmy]\\(?:[/ 
][-+]?[0-9]+[hdwmy]\\)?\\) ?" old-date) (match-string 1 old-date)))) (cond 
((equal arg (quote (4))) (progn (if (and old-date org-log-reschedule) (progn 
(org-add-log-setup ... nil old-date ... org-log-reschedule))) 
(org-remove-timestamp-with-keyword org-scheduled-string) (message "Item is no 
longer scheduled."))) ((equal arg (quote (16))) (save-excursion (if 
(re-search-forward org-scheduled-time-regexp (save-excursion ... ...) t) (let* 
(... ...) (replace-match ... t t)) (user-error "No scheduled information to 
update")))) (t (org-add-planning-info (quote scheduled) time (quote closed)) 
(if (and old-date org-log-reschedule (not (equal old-date ...))) (progn 
(org-add-log-setup (quote reschedule) nil old-date (quote findpos) 
org-log-reschedule))) (if repeater (progn (save-excursion (org-back-to-heading 
t) (if ... ...)))) (message "Scheduled to %s" org-last-inserted-timestamp)))))
  org-schedule(nil nil)
  (setq ts (org-schedule arg time))
  (save-current-buffer (set-buffer buffer) (widen) (goto-char pos) (setq ts 
(org-schedule arg time)))
  (let ((--cline (org-current-line)) (--cmd this-command) (--buf1 
(current-buffer)) (--buf2 buffer) (--undo1 buffer-undo-list) (--undo2 
(save-current-buffer (set-buffer buffer) buffer-undo-list)) --c1 --c2) 
(save-current-buffer (set-buffer buffer) (widen) (goto-char pos) (setq ts 
(org-schedule arg time))) (org-agenda-show-new-time marker ts " S") (if 
org-agenda-allow-remote-undo (progn (setq --c1 (org-verify-change-for-undo 
--undo1 (save-current-buffer (set-buffer --buf1) buffer-undo-list)) --c2 
(org-verify-change-for-undo --undo2 (save-current-buffer (set-buffer --buf2) 
buffer-undo-list))) (if (or --c1 --c2) (progn (and --c1 (save-current-buffer 
(set-buffer --buf1) (undo-boundary))) (and --c2 (save-current-buffer 
(set-buffer --buf2) (undo-boundary))) (setq org-agenda-undo-list (cons (list 
--cmd --cline --buf1 --c1 --buf2 --c2) org-agenda-undo-list)))))))
  (let* ((marker (or (org-get-at-bol (quote org-marker)) (org-agenda-error))) 
(type (marker-insertion-type marker)) (buffer (marker-buffer marker)) (pos 
(marker-position marker)) (org-insert-labeled-timestamps-at-point nil) ts) 
(set-marker-insertion-type marker t) (let ((--cline (org-current-line)) (--cmd 
this-command) (--buf1 (current-buffer)) (--buf2 buffer) (--undo1 
buffer-undo-list) (--undo2 (save-current-buffer (set-buffer buffer) 
buffer-undo-list)) --c1 --c2) (save-current-buffer (set-buffer buffer) (widen) 
(goto-char pos) (setq ts (org-schedule arg time))) (org-agenda-show-new-time 
marker ts " S") (if org-agenda-allow-remote-undo (progn (setq --c1 
(org-verify-change-for-undo --undo1 (save-current-buffer (set-buffer --buf1) 
buffer-undo-list)) --c2 (org-verify-change-for-undo --undo2 
(save-current-buffer (set-buffer --buf2) buffer-undo-list))) (if (or --c1 --c2) 
(progn (and --c1 (save-current-buffer ... ...)) (and --c2 (save-current-buffer 
... ...)) (setq org-agenda-undo-list (cons ... org-agenda-undo-list))))))) 
(message "%s" ts))
  org-agenda-schedule(nil)
  call-interactively(org-agenda-schedule nil nil)

Reply via email to