emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Litvinov Sergey <slitvinov@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] narrowing in agenda file
Date: Wed, 01 Feb 2012 16:18:55 +0100	[thread overview]
Message-ID: <5r8vkmshsw.fsf@kana.aer.mw.tum.de> (raw)
In-Reply-To: <878vkmhccw.fsf@norang.ca>

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


  reply	other threads:[~2012-02-01 15:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-23 14:41 Litvinov Sergey
2012-01-23 18:04 ` Bernt Hansen
2012-02-01 14:11   ` Bernt Hansen
2012-02-01 15:18     ` Litvinov Sergey [this message]
2012-02-02  2:15       ` Bernt Hansen
2012-02-02  7:33         ` Litvinov Sergey
2012-02-12 21:27           ` Bernt Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5r8vkmshsw.fsf@kana.aer.mw.tum.de \
    --to=slitvinov@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).