GNU bug report logs -
#5093
23.1.50; including diary entries from narrowed buffers
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5093 in the body.
You can then email your comments to 5093 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#5093
; Package
emacs
.
(Tue, 01 Dec 2009 16:50:06 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
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 01 Dec 2009 16:50:11 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
[Message part 1 (text/plain, inline)]
1. Save a ~/.todo-do file with entries in two categories, e.g. (this
file can be created from emacs -Q, e.g. by calling todo-show):
==cut==
-*- mode: todo; todo-categories: ("test" "Todo"); -*-
*/* --- test
*/* 2009-11-30 00:47 steve: another item
--- End
*/* ---------------------------------------------------------------------------
*/* --- Todo
*/* 2009-11-29 21:48 steve: todo item
--- End
*/* ---------------------------------------------------------------------------
==cut==
2. Save ~/diary with a line to include the todo file:
==cut==
#include "~/.todo-do"
==cut==
3. Save ~/.emacs with the following content (or start from emacs -Q and
either use the Custom interface for diary-list-entries-hook or eval
(add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)):
==cut==
(custom-set-variables
'(diary-list-entries-hook (quote (diary-include-other-diary-files))))
==cut==
4. Restart Emacs, type `M-x diary', answer y to the question about
applying the local variables list for todo-categories.
=> A buffer pops up with the following fancy diary display:
Tuesday, December 1, 2009
=========================
--- test
2009-11-30 00:47 steve: another item
---------------------------------------------------------------------------
--- Todo
2009-11-29 21:48 steve: todo item
---------------------------------------------------------------------------
5. Type `M-x todo-show' to visit the todo file in Todo mode (category
"test"), then type type `M-x diary' again.
=> Now fancy diary display looks like this:
Tuesday, December 1, 2009
=========================
2009-11-29 00:47 steve: another item
The output after step 5 is incomplete, in contrast to the output after
step 4. (The latter is the intended output, as seen by the lines in
~/.todo-do with the prefix '*/*', which are added to each day's diary
entries.) This is because diary-list-entries-2 in diary-lib.el, which
contains the search routine for new diary entries, does not take
possible narrowing into account, and that is in effect in Todo mode.
The patch below fixes this. It assumes that narrowing should always be
suspended when searching for new diary entries, which seems reasonable
(the alternative would, AFAICT, require checking individual major
modes). The problem also exists in Emacs 22, but that needs a separate
patch to list-diary-entries, due to this function being split up in
Emacs 23. I don't have the Emacs 22 CVS branch at hand, so I can't
include the needed patch.
Steve Berman
2009-12-01 Stephen Berman <stephen.berman <at> gmx.net>
* calendar/diary-lib.el (diary-list-entries-2): Use
save-restriction and widen in order to include all entries from
files being visited with narrowing, as in Todo mode (bug#5XXX).
[Message part 2 (text/plain, inline)]
*** emacs/lisp/calendar/diary-lib.el.~1.195.~ 2009-11-12 22:21:21.000000000 +0100
--- emacs/lisp/calendar/diary-lib.el 2009-12-01 17:07:35.000000000 +0100
***************
*** 648,682 ****
(if symbol (regexp-quote symbol) "")
(mapconcat 'eval date-form "\\)\\(?:")))
entry-start date-start temp)
! (goto-char (point-min))
! (while (re-search-forward regexp nil t)
! (if backup (re-search-backward "\\<" nil t))
! ;; regexp moves us past the end of date, onto the next line.
! ;; Trailing whitespace after date not allowed (see diary-file).
! (if (and (bolp) (not (looking-at "[ \t]")))
! ;; Diary entry that consists only of date.
! (backward-char 1)
! ;; Found a nonempty diary entry--make it
! ;; visible and add it to the list.
! (setq date-start (line-end-position 0))
! ;; Actual entry starts on the next-line?
! (if (looking-at "[ \t]*\n[ \t]") (forward-line 1))
! (setq entry-found t
! entry-start (point))
! (forward-line 1)
! (while (looking-at "[ \t]") ; continued entry
! (forward-line 1))
! (unless (and (eobp) (not (bolp)))
! (backward-char 1))
! (unless list-only
! (remove-overlays date-start (point) 'invisible 'diary))
! (setq temp (diary-pull-attrs
! (buffer-substring-no-properties
! entry-start (point)) globattr))
! (diary-add-to-list
! (or gdate date) (car temp)
! (buffer-substring-no-properties (1+ date-start) (1- entry-start))
! (copy-marker entry-start) (cadr temp))))))
entry-found))
(defvar original-date) ; from diary-list-entries
--- 648,684 ----
(if symbol (regexp-quote symbol) "")
(mapconcat 'eval date-form "\\)\\(?:")))
entry-start date-start temp)
! (save-restriction
! (widen)
! (goto-char (point-min))
! (while (re-search-forward regexp nil t)
! (if backup (re-search-backward "\\<" nil t))
! ;; regexp moves us past the end of date, onto the next line.
! ;; Trailing whitespace after date not allowed (see diary-file).
! (if (and (bolp) (not (looking-at "[ \t]")))
! ;; Diary entry that consists only of date.
! (backward-char 1)
! ;; Found a nonempty diary entry--make it
! ;; visible and add it to the list.
! (setq date-start (line-end-position 0))
! ;; Actual entry starts on the next-line?
! (if (looking-at "[ \t]*\n[ \t]") (forward-line 1))
! (setq entry-found t
! entry-start (point))
! (forward-line 1)
! (while (looking-at "[ \t]") ; continued entry
! (forward-line 1))
! (unless (and (eobp) (not (bolp)))
! (backward-char 1))
! (unless list-only
! (remove-overlays date-start (point) 'invisible 'diary))
! (setq temp (diary-pull-attrs
! (buffer-substring-no-properties
! entry-start (point)) globattr))
! (diary-add-to-list
! (or gdate date) (car temp)
! (buffer-substring-no-properties (1+ date-start) (1- entry-start))
! (copy-marker entry-start) (cadr temp)))))))
entry-found))
(defvar original-date) ; from diary-list-entries
Reply sent
to
Glenn Morris <rgm <at> gnu.org>
:
You have taken responsibility.
(Wed, 02 Dec 2009 03:15:21 GMT)
Full text and
rfc822 format available.
Notification sent
to
Stephen Berman <stephen.berman <at> gmx.net>
:
bug acknowledged by developer.
(Wed, 02 Dec 2009 03:15:21 GMT)
Full text and
rfc822 format available.
Message #10 received at 5093-done <at> emacsbugs.donarmstrong.com (full text, mbox):
I installed a similar fix.
bug archived.
Request was from
Debbugs Internal Request <bug-gnu-emacs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 30 Dec 2009 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 15 years and 235 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.