GNU bug report logs - #33423
27.0.50; Marking diary entries from included files

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Sun, 18 Nov 2018 22:59:02 UTC

Severity: normal

Found in version 27.0.50

Fixed in version 27.1

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 33423 in the body.
You can then email your comments to 33423 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 bug-gnu-emacs <at> gnu.org:
bug#33423; Package emacs. (Sun, 18 Nov 2018 22:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stephen Berman <stephen.berman <at> gmx.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 18 Nov 2018 22:59:02 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; Marking diary entries from included files
Date: Sun, 18 Nov 2018 23:57:47 +0100
0. Save the following files (this can all be done from emacs -Q but this
is easier and doesn't affect the bug):
~/.emacs with this content:
----------------------------------------------------------------
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(calendar-mark-diary-entries-flag t)
 '(diary-mark-entries-hook '(diary-mark-included-diary-files))
)
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
----------------------------------------------------------------
~/.emacs.d/diary with this content:
----------------------------------------------------------------
#include "~/.emacs.d/todo/test.todo"
Nov 16, 2018 test
----------------------------------------------------------------
~/.emacs.d/todo/test.todo with this content:
----------------------------------------------------------------
(("cat1" . [1 0 0 0]) ("cat2" . [1 1 0 0]))
--==-- cat1
[Nov 18, 2018] Not a diary item

==--== DONE 
--==-- cat2
* *, * Diary item

==--== DONE 
----------------------------------------------------------------

1. Start emacs without -Q

2. M-x calendar
=> The Calendar is displayed with all dates marked red as diary entries
(using the default diary face), as it should be, since the file
~/.emacs.d/todo/test.todo is included as a diary file and in the todo item
"* *, * Diary item" "* *, *" means this is diary item for every day.

3. M-x todo-show
=> The window the Calendar was displayed in now shows a Todo mode buffer
displaying cat1 of the above file:
[Nov 18, 2018] Not a diary item

4. M-x calendar
=> The same window now displays the Calendar again, but now only November
16, 2018 (the date of the item in ~/.emacs.d/diary) is marked as a diary
entry, instead of every date.

The reason is that diary-mark-entries does not take narrowing of
included files into account (todo-mode files are narrowed to the current
category: if after step 3 above you type `f' in the todo-mode buffer, it
then displays the next category, and now doing step 4 does show the
Calendar with all dates marked as diary items).

The following patch fixes this.  (Only nine years after bug#5093; better
late than never.  But I guess too late for 26.2?)

diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index acf4b20d77..1fa1aaacd3 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -1412,13 +1412,15 @@ diary-mark-entries
           (setq file-glob-attrs (nth 1 (diary-pull-attrs nil '())))
           (with-syntax-table diary-syntax-table
             (save-excursion
-              (diary-mark-entries-1 'calendar-mark-date-pattern)
-              (diary-mark-sexp-entries)
-              ;; Although it looks like mark-entries-hook runs every time,
-              ;; diary-mark-included-diary-files binds it to nil
-              ;; (essentially) when it runs in included files.
-              (run-hooks 'diary-nongregorian-marking-hook
-                         'diary-mark-entries-hook))))
+              (save-restriction
+                (widen)
+                (diary-mark-entries-1 'calendar-mark-date-pattern)
+                (diary-mark-sexp-entries)
+                ;; Although it looks like mark-entries-hook runs every time,
+                ;; diary-mark-included-diary-files binds it to nil
+                ;; (essentially) when it runs in included files.
+                (run-hooks 'diary-nongregorian-marking-hook
+                           'diary-mark-entries-hook)))))
       (and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff)))
     (or d-incp (message "Marking diary entries...done"))))


In GNU Emacs 27.0.50 (build 13, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-11-18 built on rosalinde
Repository revision: 5d140800398287c20230dda79162a7c40016d88e
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12001000
System Description: 8.3




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33423; Package emacs. (Sun, 25 Nov 2018 13:13:01 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: 33423 <at> debbugs.gnu.org
Subject: Re: bug#33423: Acknowledgement (27.0.50;
 Marking diary entries from included files)
Date: Sun, 25 Nov 2018 14:12:22 +0100
On Sun, 18 Nov 2018 23:57:32 +0100 Stephen Berman <stephen.berman <at> gmx.net> wrote:

> The reason is that diary-mark-entries does not take narrowing of
> included files into account (todo-mode files are narrowed to the current
> category: if after step 3 above you type `f' in the todo-mode buffer, it
> then displays the next category, and now doing step 4 does show the
> Calendar with all dates marked as diary items).
>
> The following patch fixes this.  (Only nine years after bug#5093; better
> late than never.  But I guess too late for 26.2?)

I've seen no objections, so I committed this to master.

Steve Berman




bug marked as fixed in version 27.1, send any further explanations to 33423 <at> debbugs.gnu.org and Stephen Berman <stephen.berman <at> gmx.net> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 28 Nov 2018 01:18:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 26 Dec 2018 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 176 days ago.

Previous Next


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