emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "G. Martin Butz" <mb@mkblog.org>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Strange Behaviour while rescheduling date
Date: Sat, 21 Sep 2013 18:41:22 +0200	[thread overview]
Message-ID: <523DCC32.1030009@mkblog.org> (raw)
In-Reply-To: <523C9E31.7090107@mkblog.org>

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

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, mb@mkblog.org, 0421 98749324, www.mkblog.org |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[-- Attachment #2: backtrace.txt --]
[-- Type: text/plain, Size: 16327 bytes --]

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	other threads:[~2013-09-21 16:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20 19:12 Strange Behaviour while rescheduling date G. Martin Butz
2013-09-21 16:41 ` G. Martin Butz [this message]
2013-09-23  7:46   ` Sebastien Vauban
2013-09-23  7:50     ` Carsten Dominik
2013-09-23  8:34     ` G. Martin Butz
2013-09-21 17:38 ` G. Martin Butz

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=523DCC32.1030009@mkblog.org \
    --to=mb@mkblog.org \
    --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).