From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#8920: 24.0.50; Calendar raises error with #included diary file Date: Fri, 24 Jun 2011 23:32:31 +0200 Message-ID: <87pqm229w0.fsf@escher.fritz.box> References: <878vst8o5i.fsf@escher.fritz.box> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1308951216 28864 80.91.229.12 (24 Jun 2011 21:33:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 24 Jun 2011 21:33:36 +0000 (UTC) Cc: 8920@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 24 23:33:29 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QaE0H-0001oH-A5 for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Jun 2011 23:33:29 +0200 Original-Received: from localhost ([::1]:38781 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaE0G-0005dT-2F for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Jun 2011 17:33:28 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:52750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaDzs-0005cU-V3 for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2011 17:33:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QaDzr-00064A-4t for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2011 17:33:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaDzq-000640-Tq for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2011 17:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QaDzq-0006uw-2n; Fri, 24 Jun 2011 17:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jun 2011 21:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8920 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8920-submit@debbugs.gnu.org id=B8920.130895116626568 (code B ref 8920); Fri, 24 Jun 2011 21:33:02 +0000 Original-Received: (at 8920) by debbugs.gnu.org; 24 Jun 2011 21:32:46 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QaDzZ-0006uT-Gm for submit@debbugs.gnu.org; Fri, 24 Jun 2011 17:32:45 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QaDzS-0006uC-KP for 8920@debbugs.gnu.org; Fri, 24 Jun 2011 17:32:44 -0400 Original-Received: (qmail invoked by alias); 24 Jun 2011 21:32:32 -0000 Original-Received: from i59F547A0.versanet.de (EHLO escher.home) [89.245.71.160] by mail.gmx.net (mp062) with SMTP; 24 Jun 2011 23:32:32 +0200 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX18JBwkYDyEJr4NQth0pW9sD3EgfaxgJkMGUy0Iywc BWzb8WtCj+l1aQ Original-Received: by escher.home (Postfix, from userid 1000) id 452615F926; Fri, 24 Jun 2011 23:32:31 +0200 (CEST) In-Reply-To: (Glenn Morris's message of "Fri, 24 Jun 2011 14:49:43 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 24 Jun 2011 17:33:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:47449 Archived-At: On Fri, 24 Jun 2011 14:49:43 -0400 Glenn Morris wrote: > Stephen Berman wrote: > >> (add-hook 'find-file-hook >> (lambda () (set-window-buffer (selected-window) >> (set-buffer (current-buffer))))) > > Help me out: what is this supposed to be for? I'm working on a new version of Todo mode (which I hope to submit for possible inclusion in Emacs 24, depending on when the feature freeze begins) which is defined so that visiting a file assigned (by auto-mode-alist) to that mode executes code to display the file appropriately by calling the new version of todo-show, which contains the set-window-buffer sexp. And such a file is suitable for diary inclusion, because it may contain Todo items that are recognized as diary entries. > Since find-file-noselect runs find-file-hook, at first sight it looks to > me like all you are doing is deliberately breaking find-file-noselect. The above is just the minimal self-contained code that induces the error; in the actual code the set-window-buffer sexp is contained in a conditional call to the new version of todo-show. It isn't necessary to do this in find-file-hook; in fact, I had previously included the conditional call directly in the new version of the mode function todo-mode, then thought it would be cleaner to delegate it to a hook. But maybe you're right that find-file-hook isn't appropriate. In any case, the Calendar problem is caused by calling that sexp, whether or not it is in find-file-hook. > So my initial reaction is: "if it hurts when you do that, don't do that". I anticipated this reaction, and even had it myself, after encountering the problem; the thing is, I didn't know I was doing that :-(. That is, my intention was to invoke todo-show when the user chooses to visit a todo file directly (instead of interactively calling todo-show); I didn't consider the case where the file is visited programmatically. I don't know how to distinguish the two cases in this context; called-interactively-p won't DTRT, precisely because the command the user invokes to visit the file is not part of Todo mode. So I'm hoping there's a way within calendar.el to avoid the error. Steve Berman