emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: Litvinov Sergey <slitvinov@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] narrowing in agenda file
Date: Sun, 12 Feb 2012 16:27:26 -0500	[thread overview]
Message-ID: <87bop368u9.fsf@norang.ca> (raw)
In-Reply-To: 5r1uqdlmfd.fsf@kana.aer.mw.tum.de

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

      reply	other threads:[~2012-02-12 21:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=87bop368u9.fsf@norang.ca \
    --to=bernt@norang.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=slitvinov@gmail.com \
    /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).