all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#5093: 23.1.50; including diary entries from narrowed buffers
@ 2009-12-01 16:40 ` Stephen Berman
  2009-12-02  3:15   ` bug#5093: marked as done (23.1.50; including diary entries from narrowed buffers) Emacs bug Tracking System
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Berman @ 2009-12-01 16:40 UTC (permalink / raw)
  To: emacs-pretest-bug

[-- Attachment #1: Type: text/plain, Size: 2735 bytes --]

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


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 3525 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#5093: marked as done (23.1.50; including diary entries from narrowed buffers)
  2009-12-01 16:40 ` bug#5093: 23.1.50; including diary entries from narrowed buffers Stephen Berman
@ 2009-12-02  3:15   ` Emacs bug Tracking System
  0 siblings, 0 replies; 2+ messages in thread
From: Emacs bug Tracking System @ 2009-12-02  3:15 UTC (permalink / raw)
  To: Glenn Morris

[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

Your message dated Tue, 01 Dec 2009 22:05:46 -0500
with message-id <btws16axdh.fsf@fencepost.gnu.org>
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 owner@emacsbugs.donarmstrong.com
immediately.)


-- 
5093: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=5093
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 8619 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 2735 bytes --]

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


[-- Attachment #2.1.2: patch --]
[-- Type: text/plain, Size: 3525 bytes --]

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

[-- Attachment #3: Type: message/rfc822, Size: 1450 bytes --]

From: Glenn Morris <rgm@gnu.org>
To: 5093-done@emacsbugs.donarmstrong.com
Subject: Re: bug#5093: 23.1.50; including diary entries from narrowed buffers
Date: Tue, 01 Dec 2009 22:05:46 -0500
Message-ID: <btws16axdh.fsf@fencepost.gnu.org>


I installed a similar fix.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-02  3:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <btws16axdh.fsf@fencepost.gnu.org>
2009-12-01 16:40 ` bug#5093: 23.1.50; including diary entries from narrowed buffers Stephen Berman
2009-12-02  3:15   ` bug#5093: marked as done (23.1.50; including diary entries from narrowed buffers) Emacs bug Tracking System

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.