emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-agenda-files for calfw
@ 2015-08-27 12:06 Julien Cubizolles
  2015-08-27 15:01 ` Eric S Fraga
  0 siblings, 1 reply; 9+ messages in thread
From: Julien Cubizolles @ 2015-08-27 12:06 UTC (permalink / raw)
  To: emacs-orgmode

I'd like to choose only a few of my org-agenda-files to be displayed by
cfw:open-org-calendar. I couldn't find a variable for that. Should I use
some temporary variable to store the content of the real
org-agenda-files while launching calfw or is there an easier way ?

Julien.

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

* Re: org-agenda-files for calfw
  2015-08-27 12:06 org-agenda-files for calfw Julien Cubizolles
@ 2015-08-27 15:01 ` Eric S Fraga
  2015-08-27 21:35   ` Julien Cubizolles
  2015-08-27 22:52   ` Julien Cubizolles
  0 siblings, 2 replies; 9+ messages in thread
From: Eric S Fraga @ 2015-08-27 15:01 UTC (permalink / raw)
  To: Julien Cubizolles; +Cc: emacs-orgmode

On Thursday, 27 Aug 2015 at 14:06, Julien Cubizolles wrote:
> I'd like to choose only a few of my org-agenda-files to be displayed by
> cfw:open-org-calendar. I couldn't find a variable for that. Should I use
> some temporary variable to store the content of the real
> org-agenda-files while launching calfw or is there an easier way ?

You could try advising the function maybe?

https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-176-g45abec

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

* Re: org-agenda-files for calfw
  2015-08-27 15:01 ` Eric S Fraga
@ 2015-08-27 21:35   ` Julien Cubizolles
  2015-08-27 22:52   ` Julien Cubizolles
  1 sibling, 0 replies; 9+ messages in thread
From: Julien Cubizolles @ 2015-08-27 21:35 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Thursday, 27 Aug 2015 at 14:06, Julien Cubizolles wrote:
>> I'd like to choose only a few of my org-agenda-files to be displayed by
>> cfw:open-org-calendar. I couldn't find a variable for that. Should I use
>> some temporary variable to store the content of the real
>> org-agenda-files while launching calfw or is there an easier way ?
>
> You could try advising the function maybe?
>
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html

Thanks for this advice... I'll try to something with make-local-variable
in an advice around the function calling the agenda.

Julien.

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

* Re: org-agenda-files for calfw
  2015-08-27 15:01 ` Eric S Fraga
  2015-08-27 21:35   ` Julien Cubizolles
@ 2015-08-27 22:52   ` Julien Cubizolles
  2015-08-28  2:19     ` Nick Dokos
  1 sibling, 1 reply; 9+ messages in thread
From: Julien Cubizolles @ 2015-08-27 22:52 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Thursday, 27 Aug 2015 at 14:06, Julien Cubizolles wrote:
>> I'd like to choose only a few of my org-agenda-files to be displayed by
>> cfw:open-org-calendar. I couldn't find a variable for that. Should I use
>> some temporary variable to store the content of the real
>> org-agenda-files while launching calfw or is there an easier way ?
>
> You could try advising the function maybe?
>
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html

OK, here is my first unsuccessful attempt. I've never used advises
before so I'm not even sure it makes sense. 

--8<---------------cut here---------------start------------->8---
(defun jc-change-agenda-files ()
  (make-local-variable 'org-agenda-files)
  (setq org-agenda-files '('"~/org/orgfiles/planning.org")))

(advice-add 'cfw:open-org-calendar :before
	      'jc-change-agenda-files)
--8<---------------cut here---------------end--------------->8---

When I run cfw:open-org-calendar, I see entries from all my agenda
files. However, without the make-local-variable part, I only get the
entries from planning.org but that's not what I want since I don't want
to change org-agenda-files for the other agenda views.

Julien.

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

* Re: org-agenda-files for calfw
  2015-08-27 22:52   ` Julien Cubizolles
@ 2015-08-28  2:19     ` Nick Dokos
  2015-08-28  9:31       ` Julien Cubizolles
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2015-08-28  2:19 UTC (permalink / raw)
  To: emacs-orgmode

Julien Cubizolles <j.cubizolles@free.fr> writes:

> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> On Thursday, 27 Aug 2015 at 14:06, Julien Cubizolles wrote:
>>> I'd like to choose only a few of my org-agenda-files to be displayed by
>>> cfw:open-org-calendar. I couldn't find a variable for that. Should I use
>>> some temporary variable to store the content of the real
>>> org-agenda-files while launching calfw or is there an easier way ?
>>
>> You could try advising the function maybe?
>>
>> https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html
>
> OK, here is my first unsuccessful attempt. I've never used advises
> before so I'm not even sure it makes sense. 
>
> (defun jc-change-agenda-files ()
>   (make-local-variable 'org-agenda-files)
>   (setq org-agenda-files '('"~/org/orgfiles/planning.org")))
>
> (advice-add 'cfw:open-org-calendar :before
> 	      'jc-change-agenda-files)
>
> When I run cfw:open-org-calendar, I see entries from all my agenda
> files. However, without the make-local-variable part, I only get the
> entries from planning.org but that's not what I want since I don't want
> to change org-agenda-files for the other agenda views.
>

Bind org-agenda-files in a let before calling cfw:open-org-calendar:

(let ((org-agenda-files '(...)))
  (cfw:open-org-calendar))

Nick

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

* Re: org-agenda-files for calfw
  2015-08-28  2:19     ` Nick Dokos
@ 2015-08-28  9:31       ` Julien Cubizolles
  2015-08-28  9:33         ` Julien Cubizolles
  0 siblings, 1 reply; 9+ messages in thread
From: Julien Cubizolles @ 2015-08-28  9:31 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:


> Bind org-agenda-files in a let before calling cfw:open-org-calendar:
>
> (let ((org-agenda-files '(...)))
>   (cfw:open-org-calendar))

That's exactly what I needed, thanks.

Julien.

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

* Re: org-agenda-files for calfw
  2015-08-28  9:31       ` Julien Cubizolles
@ 2015-08-28  9:33         ` Julien Cubizolles
  2015-08-28 13:25           ` Nick Dokos
  0 siblings, 1 reply; 9+ messages in thread
From: Julien Cubizolles @ 2015-08-28  9:33 UTC (permalink / raw)
  To: emacs-orgmode

Julien Cubizolles <j.cubizolles@free.fr> writes:

> Nick Dokos <ndokos@gmail.com> writes:
>
>
>> Bind org-agenda-files in a let before calling cfw:open-org-calendar:
>>
>> (let ((org-agenda-files '(...)))
>>   (cfw:open-org-calendar))
>
> That's exactly what I needed, thanks.

I just noticed something very weird, as soon as the agenda is recreated
(next month in a month view), the binding of org-agenda-files is lost,
and reverts to the global value...


Julien.

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

* Re: org-agenda-files for calfw
  2015-08-28  9:33         ` Julien Cubizolles
@ 2015-08-28 13:25           ` Nick Dokos
  2015-08-28 16:02             ` Julien Cubizolles
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2015-08-28 13:25 UTC (permalink / raw)
  To: emacs-orgmode

Julien Cubizolles <j.cubizolles@free.fr> writes:

> Julien Cubizolles <j.cubizolles@free.fr> writes:
>
>> Nick Dokos <ndokos@gmail.com> writes:
>>
>>
>>> Bind org-agenda-files in a let before calling cfw:open-org-calendar:
>>>
>>> (let ((org-agenda-files '(...)))
>>>   (cfw:open-org-calendar))
>>
>> That's exactly what I needed, thanks.
>
> I just noticed something very weird, as soon as the agenda is recreated
> (next month in a month view), the binding of org-agenda-files is lost,
> and reverts to the global value...
>
>

I admit I didn't read your original question very carefully, so I might
have overlooked something, but the behavior above is not weird: the let
binds org-agenda-files and then calls cfw:ooc - when that returns the
let binding is gone as well.

-- 
Nick

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

* Re: org-agenda-files for calfw
  2015-08-28 13:25           ` Nick Dokos
@ 2015-08-28 16:02             ` Julien Cubizolles
  0 siblings, 0 replies; 9+ messages in thread
From: Julien Cubizolles @ 2015-08-28 16:02 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> I admit I didn't read your original question very carefully, so I might
> have overlooked something, but the behavior above is not weird: the let
> binds org-agenda-files and then calls cfw:ooc - when that returns the
> let binding is gone as well.

It seems that the function cfw:ooo is called everytime the agenda is
redrawn. Advising cfw:ooo should be the way to go then.

Julien.

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

end of thread, other threads:[~2015-08-28 16:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-27 12:06 org-agenda-files for calfw Julien Cubizolles
2015-08-27 15:01 ` Eric S Fraga
2015-08-27 21:35   ` Julien Cubizolles
2015-08-27 22:52   ` Julien Cubizolles
2015-08-28  2:19     ` Nick Dokos
2015-08-28  9:31       ` Julien Cubizolles
2015-08-28  9:33         ` Julien Cubizolles
2015-08-28 13:25           ` Nick Dokos
2015-08-28 16:02             ` Julien Cubizolles

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