GNU bug report logs - #6999
saving included diary files does not regenerate the appointment list

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Wed, 8 Sep 2010 12:30:03 UTC

Severity: minor

Tags: patch

Found in version 23.2

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6999 in the body.
You can then email your comments to 6999 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6999; Package emacs. (Wed, 08 Sep 2010 12:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 08 Sep 2010 12:30:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.2; [PATCH] appt ignores included diary files
Date: Wed, 08 Sep 2010 13:31:42 +0100
When the main diary file includes other diary files. File saving in the
included does no appt-check, which means if one adds appointments
directly into the included file, they will not be added by
appt-update-list.

One simple solution is to make appt-update-list do appt-check if major
mode is diary-mode. Then users can open included files in diary mode and
add appointments.

diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index 3573c95..818fee4 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -660,7 +660,8 @@ hour and minute parts."
 (defun appt-update-list ()
   "If the current buffer is visiting the diary, update appointments.
 This function is intended for use with `write-file-functions'."
-  (and (string-equal buffer-file-name (expand-file-name diary-file))
+  (and (or (string-equal buffer-file-name (expand-file-name diary-file))
+           (eq major-mode 'diary-mode))
        appt-timer
        (let ((appt-display-diary nil))
          (appt-check t)))




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6999; Package emacs. (Wed, 08 Sep 2010 12:44:02 GMT) Full text and rfc822 format available.

Message #8 received at 6999 <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: 6999 <at> debbugs.gnu.org
Subject: Re: bug#6999: 23.2; [PATCH] appt ignores included diary files
Date: Wed, 08 Sep 2010 13:45:46 +0100
On 2010-09-08 13:31 +0100, Leo wrote:
> When the main diary file includes other diary files. File saving in the
> included does no appt-check, which means if one adds appointments
> directly into the included file, they will not be added by
> appt-update-list.
>
> One simple solution is to make appt-update-list do appt-check if major
> mode is diary-mode. Then users can open included files in diary mode and
> add appointments.
[...]

Annoyingly appt-check pops up the main diary buffer. So maybe do this
instead:

diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index 3573c95..32563ab 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -660,10 +660,11 @@ hour and minute parts."
 (defun appt-update-list ()
   "If the current buffer is visiting the diary, update appointments.
 This function is intended for use with `write-file-functions'."
-  (and (string-equal buffer-file-name (expand-file-name diary-file))
+  (and (or (string-equal buffer-file-name (expand-file-name diary-file))
+           (eq major-mode 'diary-mode))
        appt-timer
        (let ((appt-display-diary nil))
-         (appt-check t)))
+         (save-window-excursion (appt-check t))))
   nil)
 
 ;; In Emacs-21.3, the manual documented the following procedure to





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6999; Package emacs. (Wed, 08 Sep 2010 14:37:02 GMT) Full text and rfc822 format available.

Message #11 received at 6999 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo <sdl.web <at> gmail.com>
Cc: 6999 <at> debbugs.gnu.org
Subject: Re: bug#6999: 23.2; [PATCH] appt ignores included diary files
Date: Wed, 08 Sep 2010 16:38:42 +0200
> Annoyingly appt-check pops up the main diary buffer. So maybe do this
> instead:
[...]
> -         (appt-check t)))
> +         (save-window-excursion (appt-check t))))

Not good enough: the buffer might have popped up in a new frame, in
which case save-window-excursion won't be of any help.

Basically, you can't undo a "pop up a buffer", so the code should be
written in such a way that it's only done when it's *really* necessary.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6999; Package emacs. (Wed, 08 Sep 2010 15:06:01 GMT) Full text and rfc822 format available.

Message #14 received at 6999 <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 6999 <at> debbugs.gnu.org
Subject: Re: bug#6999: 23.2; [PATCH] appt ignores included diary files
Date: Wed, 08 Sep 2010 16:07:31 +0100
On 2010-09-08 15:38 +0100, Stefan Monnier wrote:
> Not good enough: the buffer might have popped up in a new frame, in
> which case save-window-excursion won't be of any help.
>
> Basically, you can't undo a "pop up a buffer", so the code should be
> written in such a way that it's only done when it's *really* necessary.

This form (or selective (diary-show-all-entries)) in `appt-check'
displays diary buffer. I don't know how best to fix it.

Leo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6999; Package emacs. (Tue, 14 Sep 2010 00:22:02 GMT) Full text and rfc822 format available.

Message #17 received at 6999 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Leo <sdl.web <at> gmail.com>
Cc: 6999 <at> debbugs.gnu.org
Subject: Re: bug#6999: 23.2; [PATCH] appt ignores included diary files
Date: Mon, 13 Sep 2010 20:24:13 -0400
Leo wrote:

> -  (and (string-equal buffer-file-name (expand-file-name diary-file))
> +  (and (or (string-equal buffer-file-name (expand-file-name diary-file))
> +           (eq major-mode 'diary-mode))

There's no particular reason that the included diary files should be
being visited in diary-mode. I'll try to find a different fix (I'm
thinking maybe running diary-list-entries should store a list of any
include files that were found).




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6999; Package emacs. (Tue, 14 Sep 2010 06:18:01 GMT) Full text and rfc822 format available.

Message #20 received at 6999 <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 6999 <at> debbugs.gnu.org
Subject: Re: bug#6999: 23.2; [PATCH] appt ignores included diary files
Date: Tue, 14 Sep 2010 07:19:46 +0100
On 2010-09-14 01:24 +0100, Glenn Morris wrote:
> Leo wrote:
>
>> -  (and (string-equal buffer-file-name (expand-file-name diary-file))
>> +  (and (or (string-equal buffer-file-name (expand-file-name diary-file))
>> +           (eq major-mode 'diary-mode))
>
> There's no particular reason that the included diary files should be
> being visited in diary-mode. I'll try to find a different fix (I'm
> thinking maybe running diary-list-entries should store a list of any
> include files that were found).

But the point of that is to decide whether to call appt-check (hence
diary-list-entries, which is expensive). Looks like somehow diary-lib
needs a function to return all included files without doing list
entries. Thanks for looking into this.

Leo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6999; Package emacs. (Tue, 14 Sep 2010 07:18:01 GMT) Full text and rfc822 format available.

Message #23 received at 6999 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Leo <sdl.web <at> gmail.com>
Cc: 6999 <at> debbugs.gnu.org
Subject: Re: bug#6999: 23.2; [PATCH] appt ignores included diary files
Date: Tue, 14 Sep 2010 03:20:02 -0400
emacs-23 branch:

2010-09-14  Glenn Morris  <rgm at gnu.org>

    * calendar/diary-lib.el (diary-included-files): New variable.
    (diary-list-entries): Maybe initialize diary-included-files.
    (diary-include-other-diary-files): Append to diary-included-files.
    * calendar/appt.el (appt-update-list): Also check the
    members of diary-included-files.





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6999; Package emacs. (Tue, 14 Sep 2010 07:36:01 GMT) Full text and rfc822 format available.

Message #26 received at 6999 <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 6999 <at> debbugs.gnu.org
Subject: Re: bug#6999: 23.2; [PATCH] appt ignores included diary files
Date: Tue, 14 Sep 2010 08:38:02 +0100
On 2010-09-14 08:20 +0100, Glenn Morris wrote:
> emacs-23 branch:
>
> 2010-09-14  Glenn Morris  <rgm at gnu.org>
>
>     * calendar/diary-lib.el (diary-included-files): New variable.
>     (diary-list-entries): Maybe initialize diary-included-files.
>     (diary-include-other-diary-files): Append to diary-included-files.
>     * calendar/appt.el (appt-update-list): Also check the
>     members of diary-included-files.
>

Thanks. I like your solution.

The only remaining issue is the main diary file buffer pops up when
saving in included files.

Leo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6999; Package emacs. (Tue, 14 Sep 2010 08:04:01 GMT) Full text and rfc822 format available.

Message #29 received at 6999 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Leo <sdl.web <at> gmail.com>
Cc: 6999 <at> debbugs.gnu.org
Subject: Re: bug#6999: 23.2; [PATCH] appt ignores included diary files
Date: Tue, 14 Sep 2010 04:06:07 -0400
Leo wrote:

> The only remaining issue is the main diary file buffer pops up when
> saving in included files.

I know; see the FIXME comment in appt-check.
It is only displayed if it was being visited beforehand.
It is because (diary) turns on "selective" display and we need to turn
it off again. This whole thing is a mess.




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Wed, 15 Sep 2010 02:48:02 GMT) Full text and rfc822 format available.

Notification sent to Leo <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Wed, 15 Sep 2010 02:48:02 GMT) Full text and rfc822 format available.

Message #34 received at 6999-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 6999-done <at> debbugs.gnu.org
Subject: Re: bug#6999: 23.2; [PATCH] appt ignores included diary files
Date: Tue, 14 Sep 2010 22:49:51 -0400
Fixed in emacs-23.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 13 Oct 2010 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 256 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.