bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5093: marked as done (23.1.50; including diary entries from narrowed


From: Emacs bug Tracking System
Subject: bug#5093: marked as done (23.1.50; including diary entries from narrowed buffers)
Date: Wed, 02 Dec 2009 03:15:21 +0000

Your message dated Tue, 01 Dec 2009 22:05:46 -0500
with message-id <address@hidden>
and subject line Re: bug#5093: 23.1.50; including diary entries from narrowed 
buffers
has caused the Emacs bug report #5093,
regarding 23.1.50; including diary entries from narrowed buffers
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact address@hidden
immediately.)


-- 
5093: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=5093
Emacs Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 23.1.50; including diary entries from narrowed buffers Date: Tue, 01 Dec 2009 17:40:53 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)
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  <address@hidden>

        * 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).

*** 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

--- End Message ---
--- Begin Message --- Subject: Re: bug#5093: 23.1.50; including diary entries from narrowed buffers Date: Tue, 01 Dec 2009 22:05:46 -0500 User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
I installed a similar fix.

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]