Matt Price <mopto...@gmail.com> wrote: > hmm. There's definitely something funny going on, I presume with emacs > rather than org, and (again > presumably) something to do with my configs or installed packages. The > function that's failing is > org-eval-in-calendar: > > debug(error (wrong-type-argument window-live-p nil)) > select-window(nil) > org-eval-in-calendar(nil t) > > If we look at the defun: > > (defun org-eval-in-calendar (form &optional keepdate) > "Eval FORM in the calendar window and return to current window. > Also, store the cursor date in variable org-ans2." > (let ((sf (selected-frame)) > (sw (selected-window))) > (select-window (get-buffer-window "*Calendar*" t)) > (eval form) > (when (and (not keepdate) (calendar-cursor-to-date)) > (let* ((date (calendar-cursor-to-date)) > (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date)))) > (setq org-ans2 (format-time-string "%Y-%m-%d" time)))) > (move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer)) > (select-window sw) > (org-select-frame-set-input-focus sf))) > > ------- > I think emacs is having trouble finding the buffer '*Calendar*' -- even > though it clearly exists and > can be manually selected using C-x b. I could verify this by just > eval-defun'ing this line: > (select-window (get-buffer-window "*Calendar*" t)) > > from the scratch buffer -- this produces the same backtrace. However, oddly, > after experiencing the > same issue about 6 times in a row, the problem mysteriously disappeared just > now, and the procedure > is working fine. I have no idea what the issue is there -- I'll report when > I find it again. Maybe > someone on the list can give me suggestions for debugging if it shows up > again? Thanks, >
One thing is to make sure that it is the first select-window which is failing: there is a second one in there as well. Toggling debug-on-error and getting a full backtrace (assuming you are loading .el files and not .elc files) would take care of that. If there were any concurrency, I'd suspect a race: you try to select a window that somebody else killed in the meantime. But I don't think there is anything like that going in emacs - but I don't know for sure. Nick