* [PATCH] narrowing in agenda file
@ 2012-01-23 14:41 Litvinov Sergey
2012-01-23 18:04 ` Bernt Hansen
0 siblings, 1 reply; 7+ messages in thread
From: Litvinov Sergey @ 2012-01-23 14:41 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 150 bytes --]
"Narrowing" in the agenda file does not "survive" agenda redo. Please
see an example in the first patch. I think the second patch fixes this
problem.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-a-test-narrowed-agenda-file.patch --]
[-- Type: text/x-patch, Size: 977 bytes --]
From 60ef46625131391c6a49fccd26861f933a984515 Mon Sep 17 00:00:00 2001
From: Litvinov Sergey <slitvinov@gmail.com>
Date: Mon, 23 Jan 2012 14:22:53 +0100
Subject: [PATCH 1/2] Add a test "narrowed" agenda file
---
testing/examples/org-agenda-test.org | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
create mode 100644 testing/examples/org-agenda-test.org
diff --git a/testing/examples/org-agenda-test.org b/testing/examples/org-agenda-test.org
new file mode 100644
index 0000000..ecd00e5
--- /dev/null
+++ b/testing/examples/org-agenda-test.org
@@ -0,0 +1,10 @@
+#+Title: a collection of examples for org-agenda tests
+* TODO should be visible
+ob-agenda-test.org buffer should be narrowed after execution of this block
+#+BEGIN_SRC elisp :results silent
+ (let ((org-agenda-files (list buffer-file-name)))
+ (narrow-to-region 1 (- (buffer-size) 23))
+ (org-agenda nil "t")
+ (org-agenda-redo))
+#+END_SRC
+* TODO should be hidden
--
1.7.3.4
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Make-narrowing-of-the-agenda-file-survive-org-agenda.patch --]
[-- Type: text/x-patch, Size: 3933 bytes --]
From 188d95624fec5d53403fd705679167ed7d7345a2 Mon Sep 17 00:00:00 2001
From: Litvinov Sergey <slitvinov@gmail.com>
Date: Mon, 23 Jan 2012 14:26:14 +0100
Subject: [PATCH 2/2] Make narrowing of the agenda file survive (org-agenda-redo)
* lisp/org.el (org-prepare-agenda-buffers): move '(save-excursion
(save-restriction' construction
---
lisp/org.el | 67 +++++++++++++++++++++++++++++------------------------------
1 files changed, 33 insertions(+), 34 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index f6a1160..9e23c18 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16498,47 +16498,46 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(inhibit-read-only t)
(rea (concat ":" org-archive-tag ":"))
bmp file re)
- (save-excursion
- (save-restriction
(while (setq file (pop files))
(catch 'nextfile
(if (bufferp file)
(set-buffer file)
(org-check-agenda-file file)
(set-buffer (org-get-agenda-file-buffer file)))
- (widen)
- (setq bmp (buffer-modified-p))
- (org-refresh-category-properties)
- (setq org-todo-keywords-for-agenda
- (append org-todo-keywords-for-agenda org-todo-keywords-1))
- (setq org-done-keywords-for-agenda
- (append org-done-keywords-for-agenda org-done-keywords))
- (setq org-todo-keyword-alist-for-agenda
- (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
- (setq org-drawers-for-agenda
- (append org-drawers-for-agenda org-drawers))
- (setq org-tag-alist-for-agenda
- (append org-tag-alist-for-agenda org-tag-alist))
-
(save-excursion
- (remove-text-properties (point-min) (point-max) pall)
- (when org-agenda-skip-archived-trees
- (goto-char (point-min))
- (while (re-search-forward rea nil t)
- (if (org-at-heading-p t)
- (add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
- (goto-char (point-min))
- (setq re (format org-heading-keyword-regexp-format
- org-comment-string))
- (while (re-search-forward re nil t)
- (add-text-properties
- (match-beginning 0) (org-end-of-subtree t) pc)))
- (set-buffer-modified-p bmp)))))
- (setq org-todo-keywords-for-agenda
- (org-uniquify org-todo-keywords-for-agenda))
- (setq org-todo-keyword-alist-for-agenda
- (org-uniquify org-todo-keyword-alist-for-agenda)
- org-tag-alist-for-agenda (org-uniquify org-tag-alist-for-agenda))))
+ (save-restriction
+ (widen)
+ (setq bmp (buffer-modified-p))
+ (org-refresh-category-properties)
+ (setq org-todo-keywords-for-agenda
+ (append org-todo-keywords-for-agenda org-todo-keywords-1))
+ (setq org-done-keywords-for-agenda
+ (append org-done-keywords-for-agenda org-done-keywords))
+ (setq org-todo-keyword-alist-for-agenda
+ (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
+ (setq org-drawers-for-agenda
+ (append org-drawers-for-agenda org-drawers))
+ (setq org-tag-alist-for-agenda
+ (append org-tag-alist-for-agenda org-tag-alist))
+ (save-excursion
+ (remove-text-properties (point-min) (point-max) pall)
+ (when org-agenda-skip-archived-trees
+ (goto-char (point-min))
+ (while (re-search-forward rea nil t)
+ (if (org-at-heading-p t)
+ (add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
+ (goto-char (point-min))
+ (setq re (format org-heading-keyword-regexp-format
+ org-comment-string))
+ (while (re-search-forward re nil t)
+ (add-text-properties
+ (match-beginning 0) (org-end-of-subtree t) pc)))
+ (set-buffer-modified-p bmp)))))
+ (setq org-todo-keywords-for-agenda
+ (org-uniquify org-todo-keywords-for-agenda))
+ (setq org-todo-keyword-alist-for-agenda
+ (org-uniquify org-todo-keyword-alist-for-agenda)
+ org-tag-alist-for-agenda (org-uniquify org-tag-alist-for-agenda))))
;;;; Embedded LaTeX
--
1.7.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] narrowing in agenda file
2012-01-23 14:41 [PATCH] narrowing in agenda file Litvinov Sergey
@ 2012-01-23 18:04 ` Bernt Hansen
2012-02-01 14:11 ` Bernt Hansen
0 siblings, 1 reply; 7+ messages in thread
From: Bernt Hansen @ 2012-01-23 18:04 UTC (permalink / raw
To: Litvinov Sergey; +Cc: emacs-orgmode
Litvinov Sergey <slitvinov@gmail.com> writes:
> "Narrowing" in the agenda file does not "survive" agenda redo. Please
> see an example in the first patch. I think the second patch fixes this
> problem.
Hi Sergey,
I haven't had a chance to try your patch yet but I recently tried to fix
this behaviour as well but there are other issues that crop up when you
keep the narrowed region.
Please make sure that at least the following work as expected with your
patch:
- org agenda clock reports are correct
- You don't have the LOGBOOK drawer aligned with tags when clocking in
from the agenda (this was with emacs -q (no org-indent-mode)
- Column view in the agenda shows correct clocking amounts for each
task
- Visiting a task with RET or SPC goes to the task when outside the
narrowed region
- Remote editing of a task outside the narrowed region changes the
target task and not something in your narrowed region instead
I'm hoping your patch works since I also want this desired behaviour but
so far my attempts to achieve this failed miserably :(
Regards,
Bernt
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] narrowing in agenda file
2012-01-23 18:04 ` Bernt Hansen
@ 2012-02-01 14:11 ` Bernt Hansen
2012-02-01 15:18 ` Litvinov Sergey
0 siblings, 1 reply; 7+ messages in thread
From: Bernt Hansen @ 2012-02-01 14:11 UTC (permalink / raw
To: Litvinov Sergey; +Cc: emacs-orgmode
Bernt Hansen <bernt@norang.ca> writes:
> Litvinov Sergey <slitvinov@gmail.com> writes:
>
>> "Narrowing" in the agenda file does not "survive" agenda redo. Please
>> see an example in the first patch. I think the second patch fixes this
>> problem.
>
> Hi Sergey,
>
> I haven't had a chance to try your patch yet but I recently tried to fix
> this behaviour as well but there are other issues that crop up when you
> keep the narrowed region.
>
> Please make sure that at least the following work as expected with your
> patch:
>
> - org agenda clock reports are correct
> - You don't have the LOGBOOK drawer aligned with tags when clocking in
> from the agenda (this was with emacs -q (no org-indent-mode)
> - Column view in the agenda shows correct clocking amounts for each
> task
> - Visiting a task with RET or SPC goes to the task when outside the
> narrowed region
> - Remote editing of a task outside the narrowed region changes the
> target task and not something in your narrowed region instead
>
> I'm hoping your patch works since I also want this desired behaviour but
> so far my attempts to achieve this failed miserably :(
>
> Regards,
> Bernt
Hi Litvinov,
I tried this patch today and clock reports in the agenda no longer
display for me. Could you take a look at it please?
Thanks,
Bernt
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] narrowing in agenda file
2012-02-01 14:11 ` Bernt Hansen
@ 2012-02-01 15:18 ` Litvinov Sergey
2012-02-02 2:15 ` Bernt Hansen
0 siblings, 1 reply; 7+ messages in thread
From: Litvinov Sergey @ 2012-02-01 15:18 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]
Bernt Hansen <bernt@norang.ca> writes:
> - org agenda clock reports are correct
> - You don't have the LOGBOOK drawer aligned with tags when clocking in
> from the agenda (this was with emacs -q (no org-indent-mode)
> - Column view in the agenda shows correct clocking amounts for each
> task
> - Visiting a task with RET or SPC goes to the task when outside the
> narrowed region
> - Remote editing of a task outside the narrowed region changes the
> target task and not something in your narrowed region instead
> I tried this patch today and clock reports in the agenda no longer
> display for me. Could you take a look at it please?
Hi Bernt,
thank you for the recommendations and for testing the patch. I am working
on ERT tests for the items you listed above. Also I found that
=org-agenda-add-note= does not work with narrowed agenda file.
Meanwhile I can share another patch to fix the problem with clock
reports (please see the second code block in
testing/examples/org-agenda-test.org )
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-Fix-clock-reports-in-the-agenda-add-a-test-example-f.patch --]
[-- Type: text/x-patch, Size: 2356 bytes --]
From 8824692191990c7ec4294b20c0c966bfc3e89de6 Mon Sep 17 00:00:00 2001
From: Litvinov Sergey <slitvinov@gmail.com>
Date: Wed, 1 Feb 2012 16:04:12 +0100
Subject: [PATCH 3/3] Fix clock reports in the agenda, add a test example for agenda
---
lisp/org.el | 4 +++-
testing/examples/org-agenda-test.org | 19 +++++++++++++++----
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 9e23c18..e1abbda 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16498,6 +16498,8 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(inhibit-read-only t)
(rea (concat ":" org-archive-tag ":"))
bmp file re)
+ (save-excursion
+ (save-restriction
(while (setq file (pop files))
(catch 'nextfile
(if (bufferp file)
@@ -16532,7 +16534,7 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(while (re-search-forward re nil t)
(add-text-properties
(match-beginning 0) (org-end-of-subtree t) pc)))
- (set-buffer-modified-p bmp)))))
+ (set-buffer-modified-p bmp)))))))
(setq org-todo-keywords-for-agenda
(org-uniquify org-todo-keywords-for-agenda))
(setq org-todo-keyword-alist-for-agenda
diff --git a/testing/examples/org-agenda-test.org b/testing/examples/org-agenda-test.org
index ecd00e5..b16badb 100644
--- a/testing/examples/org-agenda-test.org
+++ b/testing/examples/org-agenda-test.org
@@ -1,10 +1,21 @@
#+Title: a collection of examples for org-agenda tests
* TODO should be visible
+ CLOCK: [2010-01-01 Fri 10:00]--[2010-01-01 Fri 10:05] => 0:05
ob-agenda-test.org buffer should be narrowed after execution of this block
#+BEGIN_SRC elisp :results silent
- (let ((org-agenda-files (list buffer-file-name)))
- (narrow-to-region 1 (- (buffer-size) 23))
- (org-agenda nil "t")
- (org-agenda-redo))
+(let ((org-agenda-files (list buffer-file-name)))
+ (org-narrow-to-subtree)
+ (org-agenda nil "t")
+ (org-agenda-redo))
+#+END_SRC
+
+#+BEGIN_SRC elisp :results silent
+(let ((org-agenda-files (list buffer-file-name)))
+ (org-agenda nil "a")
+ (org-agenda-clockreport-mode 1)
+ (org-agenda-change-time-span 'year 2010)
+ (org-agenda-day-view 1)
+)
#+END_SRC
* TODO should be hidden
+ CLOCK: [2010-02-01 Mon 10:00]--[2010-02-01 Mon 10:05] => 0:05
--
1.7.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] narrowing in agenda file
2012-02-01 15:18 ` Litvinov Sergey
@ 2012-02-02 2:15 ` Bernt Hansen
2012-02-02 7:33 ` Litvinov Sergey
0 siblings, 1 reply; 7+ messages in thread
From: Bernt Hansen @ 2012-02-02 2:15 UTC (permalink / raw
To: Litvinov Sergey; +Cc: emacs-orgmode
Litvinov Sergey <slitvinov@gmail.com> writes:
> Bernt Hansen <bernt@norang.ca> writes:
>> - org agenda clock reports are correct
>> - You don't have the LOGBOOK drawer aligned with tags when clocking in
>> from the agenda (this was with emacs -q (no org-indent-mode)
>> - Column view in the agenda shows correct clocking amounts for each
>> task
>> - Visiting a task with RET or SPC goes to the task when outside the
>> narrowed region
>> - Remote editing of a task outside the narrowed region changes the
>> target task and not something in your narrowed region instead
>
>> I tried this patch today and clock reports in the agenda no longer
>> display for me. Could you take a look at it please?
>
> Hi Bernt,
>
> thank you for the recommendations and for testing the patch. I am working
> on ERT tests for the items you listed above. Also I found that
> =org-agenda-add-note= does not work with narrowed agenda file.
>
> Meanwhile I can share another patch to fix the problem with clock
> reports (please see the second code block in
> testing/examples/org-agenda-test.org )
Hi,
I can't get this patch to apply. Can you resend something I can apply
to origin/master so I can help with the testing?
Thanks,
Bernt
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] narrowing in agenda file
2012-02-02 2:15 ` Bernt Hansen
@ 2012-02-02 7:33 ` Litvinov Sergey
2012-02-12 21:27 ` Bernt Hansen
0 siblings, 1 reply; 7+ messages in thread
From: Litvinov Sergey @ 2012-02-02 7:33 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 48 bytes --]
This must be a cumulative patch against master.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-narrowing-of-the-agenda-file-survive-org-agenda.patch --]
[-- Type: text/x-patch, Size: 4810 bytes --]
From f95e9e89b47b35d5198ecaff7ee20ffb3e63b066 Mon Sep 17 00:00:00 2001
From: Litvinov Sergey <slitvinov@gmail.com>
Date: Thu, 2 Feb 2012 08:15:56 +0100
Subject: [PATCH] Make narrowing of the agenda file survive (org-agenda-redo)
* lisp/org.el (org-prepare-agenda-buffers): move '(save-excursion
(save-restriction' construction
* testing/examples/org-agenda-test.org: add examples
---
lisp/org.el | 65 +++++++++++++++++----------------
testing/examples/org-agenda-test.org | 21 +++++++++++
2 files changed, 54 insertions(+), 32 deletions(-)
create mode 100644 testing/examples/org-agenda-test.org
diff --git a/lisp/org.el b/lisp/org.el
index dc9e653..2f08579 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16575,39 +16575,40 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(set-buffer file)
(org-check-agenda-file file)
(set-buffer (org-get-agenda-file-buffer file)))
- (widen)
- (setq bmp (buffer-modified-p))
- (org-refresh-category-properties)
- (setq org-todo-keywords-for-agenda
- (append org-todo-keywords-for-agenda org-todo-keywords-1))
- (setq org-done-keywords-for-agenda
- (append org-done-keywords-for-agenda org-done-keywords))
- (setq org-todo-keyword-alist-for-agenda
- (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
- (setq org-drawers-for-agenda
- (append org-drawers-for-agenda org-drawers))
- (setq org-tag-alist-for-agenda
- (append org-tag-alist-for-agenda org-tag-alist))
-
(save-excursion
- (remove-text-properties (point-min) (point-max) pall)
- (when org-agenda-skip-archived-trees
- (goto-char (point-min))
- (while (re-search-forward rea nil t)
- (if (org-at-heading-p t)
- (add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
- (goto-char (point-min))
- (setq re (format org-heading-keyword-regexp-format
- org-comment-string))
- (while (re-search-forward re nil t)
- (add-text-properties
- (match-beginning 0) (org-end-of-subtree t) pc)))
- (set-buffer-modified-p bmp)))))
- (setq org-todo-keywords-for-agenda
- (org-uniquify org-todo-keywords-for-agenda))
- (setq org-todo-keyword-alist-for-agenda
- (org-uniquify org-todo-keyword-alist-for-agenda)
- org-tag-alist-for-agenda (org-uniquify org-tag-alist-for-agenda))))
+ (save-restriction
+ (widen)
+ (setq bmp (buffer-modified-p))
+ (org-refresh-category-properties)
+ (setq org-todo-keywords-for-agenda
+ (append org-todo-keywords-for-agenda org-todo-keywords-1))
+ (setq org-done-keywords-for-agenda
+ (append org-done-keywords-for-agenda org-done-keywords))
+ (setq org-todo-keyword-alist-for-agenda
+ (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
+ (setq org-drawers-for-agenda
+ (append org-drawers-for-agenda org-drawers))
+ (setq org-tag-alist-for-agenda
+ (append org-tag-alist-for-agenda org-tag-alist))
+ (save-excursion
+ (remove-text-properties (point-min) (point-max) pall)
+ (when org-agenda-skip-archived-trees
+ (goto-char (point-min))
+ (while (re-search-forward rea nil t)
+ (if (org-at-heading-p t)
+ (add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
+ (goto-char (point-min))
+ (setq re (format org-heading-keyword-regexp-format
+ org-comment-string))
+ (while (re-search-forward re nil t)
+ (add-text-properties
+ (match-beginning 0) (org-end-of-subtree t) pc)))
+ (set-buffer-modified-p bmp)))))))
+ (setq org-todo-keywords-for-agenda
+ (org-uniquify org-todo-keywords-for-agenda))
+ (setq org-todo-keyword-alist-for-agenda
+ (org-uniquify org-todo-keyword-alist-for-agenda)
+ org-tag-alist-for-agenda (org-uniquify org-tag-alist-for-agenda))))
;;;; Embedded LaTeX
diff --git a/testing/examples/org-agenda-test.org b/testing/examples/org-agenda-test.org
new file mode 100644
index 0000000..b16badb
--- /dev/null
+++ b/testing/examples/org-agenda-test.org
@@ -0,0 +1,21 @@
+#+Title: a collection of examples for org-agenda tests
+* TODO should be visible
+ CLOCK: [2010-01-01 Fri 10:00]--[2010-01-01 Fri 10:05] => 0:05
+ob-agenda-test.org buffer should be narrowed after execution of this block
+#+BEGIN_SRC elisp :results silent
+(let ((org-agenda-files (list buffer-file-name)))
+ (org-narrow-to-subtree)
+ (org-agenda nil "t")
+ (org-agenda-redo))
+#+END_SRC
+
+#+BEGIN_SRC elisp :results silent
+(let ((org-agenda-files (list buffer-file-name)))
+ (org-agenda nil "a")
+ (org-agenda-clockreport-mode 1)
+ (org-agenda-change-time-span 'year 2010)
+ (org-agenda-day-view 1)
+)
+#+END_SRC
+* TODO should be hidden
+ CLOCK: [2010-02-01 Mon 10:00]--[2010-02-01 Mon 10:05] => 0:05
--
1.7.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] narrowing in agenda file
2012-02-02 7:33 ` Litvinov Sergey
@ 2012-02-12 21:27 ` Bernt Hansen
0 siblings, 0 replies; 7+ messages in thread
From: Bernt Hansen @ 2012-02-12 21:27 UTC (permalink / raw
To: Litvinov Sergey; +Cc: emacs-orgmode
Hi Sergey,
I've applied this patch but I still can't generate agenda log reports
using 'R' in the agenda with this patch applied.
The clock reports seem to be generated and inserted directly in my org
files (corrupting data a bit) instead of being inserted in my agenda.
I've dropped this patch for now.
Regards,
Bernt
Litvinov Sergey <slitvinov@gmail.com> writes:
> This must be a cumulative patch against master.
> From f95e9e89b47b35d5198ecaff7ee20ffb3e63b066 Mon Sep 17 00:00:00 2001
> From: Litvinov Sergey <slitvinov@gmail.com>
> Date: Thu, 2 Feb 2012 08:15:56 +0100
> Subject: [PATCH] Make narrowing of the agenda file survive (org-agenda-redo)
>
> * lisp/org.el (org-prepare-agenda-buffers): move '(save-excursion
> (save-restriction' construction
> * testing/examples/org-agenda-test.org: add examples
> ---
> lisp/org.el | 65 +++++++++++++++++----------------
> testing/examples/org-agenda-test.org | 21 +++++++++++
> 2 files changed, 54 insertions(+), 32 deletions(-)
> create mode 100644 testing/examples/org-agenda-test.org
>
> diff --git a/lisp/org.el b/lisp/org.el
> index dc9e653..2f08579 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -16575,39 +16575,40 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
> (set-buffer file)
> (org-check-agenda-file file)
> (set-buffer (org-get-agenda-file-buffer file)))
> - (widen)
> - (setq bmp (buffer-modified-p))
> - (org-refresh-category-properties)
> - (setq org-todo-keywords-for-agenda
> - (append org-todo-keywords-for-agenda org-todo-keywords-1))
> - (setq org-done-keywords-for-agenda
> - (append org-done-keywords-for-agenda org-done-keywords))
> - (setq org-todo-keyword-alist-for-agenda
> - (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
> - (setq org-drawers-for-agenda
> - (append org-drawers-for-agenda org-drawers))
> - (setq org-tag-alist-for-agenda
> - (append org-tag-alist-for-agenda org-tag-alist))
> -
> (save-excursion
> - (remove-text-properties (point-min) (point-max) pall)
> - (when org-agenda-skip-archived-trees
> - (goto-char (point-min))
> - (while (re-search-forward rea nil t)
> - (if (org-at-heading-p t)
> - (add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
> - (goto-char (point-min))
> - (setq re (format org-heading-keyword-regexp-format
> - org-comment-string))
> - (while (re-search-forward re nil t)
> - (add-text-properties
> - (match-beginning 0) (org-end-of-subtree t) pc)))
> - (set-buffer-modified-p bmp)))))
> - (setq org-todo-keywords-for-agenda
> - (org-uniquify org-todo-keywords-for-agenda))
> - (setq org-todo-keyword-alist-for-agenda
> - (org-uniquify org-todo-keyword-alist-for-agenda)
> - org-tag-alist-for-agenda (org-uniquify org-tag-alist-for-agenda))))
> + (save-restriction
> + (widen)
> + (setq bmp (buffer-modified-p))
> + (org-refresh-category-properties)
> + (setq org-todo-keywords-for-agenda
> + (append org-todo-keywords-for-agenda org-todo-keywords-1))
> + (setq org-done-keywords-for-agenda
> + (append org-done-keywords-for-agenda org-done-keywords))
> + (setq org-todo-keyword-alist-for-agenda
> + (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
> + (setq org-drawers-for-agenda
> + (append org-drawers-for-agenda org-drawers))
> + (setq org-tag-alist-for-agenda
> + (append org-tag-alist-for-agenda org-tag-alist))
> + (save-excursion
> + (remove-text-properties (point-min) (point-max) pall)
> + (when org-agenda-skip-archived-trees
> + (goto-char (point-min))
> + (while (re-search-forward rea nil t)
> + (if (org-at-heading-p t)
> + (add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
> + (goto-char (point-min))
> + (setq re (format org-heading-keyword-regexp-format
> + org-comment-string))
> + (while (re-search-forward re nil t)
> + (add-text-properties
> + (match-beginning 0) (org-end-of-subtree t) pc)))
> + (set-buffer-modified-p bmp)))))))
> + (setq org-todo-keywords-for-agenda
> + (org-uniquify org-todo-keywords-for-agenda))
> + (setq org-todo-keyword-alist-for-agenda
> + (org-uniquify org-todo-keyword-alist-for-agenda)
> + org-tag-alist-for-agenda (org-uniquify org-tag-alist-for-agenda))))
>
> ;;;; Embedded LaTeX
>
> diff --git a/testing/examples/org-agenda-test.org b/testing/examples/org-agenda-test.org
> new file mode 100644
> index 0000000..b16badb
> --- /dev/null
> +++ b/testing/examples/org-agenda-test.org
> @@ -0,0 +1,21 @@
> +#+Title: a collection of examples for org-agenda tests
> +* TODO should be visible
> + CLOCK: [2010-01-01 Fri 10:00]--[2010-01-01 Fri 10:05] => 0:05
> +ob-agenda-test.org buffer should be narrowed after execution of this block
> +#+BEGIN_SRC elisp :results silent
> +(let ((org-agenda-files (list buffer-file-name)))
> + (org-narrow-to-subtree)
> + (org-agenda nil "t")
> + (org-agenda-redo))
> +#+END_SRC
> +
> +#+BEGIN_SRC elisp :results silent
> +(let ((org-agenda-files (list buffer-file-name)))
> + (org-agenda nil "a")
> + (org-agenda-clockreport-mode 1)
> + (org-agenda-change-time-span 'year 2010)
> + (org-agenda-day-view 1)
> +)
> +#+END_SRC
> +* TODO should be hidden
> + CLOCK: [2010-02-01 Mon 10:00]--[2010-02-01 Mon 10:05] => 0:05
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-02-12 21:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-23 14:41 [PATCH] narrowing in agenda file Litvinov Sergey
2012-01-23 18:04 ` Bernt Hansen
2012-02-01 14:11 ` Bernt Hansen
2012-02-01 15:18 ` Litvinov Sergey
2012-02-02 2:15 ` Bernt Hansen
2012-02-02 7:33 ` Litvinov Sergey
2012-02-12 21:27 ` Bernt Hansen
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.