emacs-calfw icon indicating copy to clipboard operation
emacs-calfw copied to clipboard

Add example of calfw opening for org-agenda-custom-commands

Open olberger opened this issue 12 years ago • 11 comments

In org-mode, org-agenda-custom-commands allows customizing the kind of org agenda views to display.

I think it should be great to add to calfw-org's documentation an example on how this could be done.

I'm no emacs lisper but I've hacked the following which seems to work :

(defun open-calfw-agenda-org (coin) (interactive) (cfw:open-org-calendar) )

(setq org-agenda-custom-commands '(

("G" "Graphical display in calfw" open-calfw-agenda-org )

) )

There's probably a cleaner way to do the same.

Hope this helps.

olberger avatar Apr 30 '12 15:04 olberger

Hi Olivier, Thank you for your advice! While I'm not using org-agenda so much, I think that your code which is integrated org-agenda tightly looks smarter. After my studying org-agenda integration, I will add your example code to the calf-org document.

kiwanami avatar May 01 '12 13:05 kiwanami

Note: you can also set org-agenda-skip-function and it'll be used by calfw (doesn't seem like org-agenda-overriding-header nor org-agenda-include-diary are respected though). Here's the one I use:

(defun cfw:open-org-calendar-nonwork (&args)
  (interactive)
  (let ((org-agenda-skip-function 'org-agenda-skip-work))
    (cfw:open-org-calendar)))

(setq org-agenda-custom-commands
      '(;; …
    ("c" "calfw, non-work"
     cfw:open-org-calendar-nonwork)))

(where the skip-function can exclude certain tags or files or subtrees that I don't want in my non-work calendar)

unhammer avatar May 02 '12 10:05 unhammer

Hi,

When I display calfw, I get all the TODO entries of all my org-agenda files in the current day, regardless of their due date. Is there a way to display the TODO entries only on the days they are due (scheduled or deadline). In org-mode I use a custom agenda command which is like this:

("D" "Daily Action List" ((agenda "" ((org-agenda-ndays 1) (org-agenda-sorting-strategy (quote ((agenda time-up priority-down tag-up)))) (org-deadline-warning-days 0)))) nil)

Thanks for your help!

Jordi

inglada avatar May 07 '12 07:05 inglada

inglada [email protected] writes:

Hi,

When I display calfw, I get all the TODO entries of all my org-agenda files in the current day, regardless of their due date. Is there a way to display the TODO entries only on the days they are due (scheduled or deadline). In org-mode I use a custom agenda command which is like this:

("D" "Daily Action List" ((agenda "" ((org-agenda-ndays 1) (org-agenda-sorting-strategy (quote ((agenda time-up priority-down tag-up)))) (org-deadline-warning-days 0)))) nil)

Does

(let ((org-agenda-sorting-strategy (quote ((agenda time-up priority-down tag-up)))) (org-deadline-warning-days 0)) (cfw:open-org-calendar))

work?

unhammer avatar May 07 '12 08:05 unhammer

@unhammer

Thanks for your answer, but there is no difference using your code snippet.

inglada avatar May 07 '12 08:05 inglada

OK. I found a way. I have to use (setq org-deadline-warning-days 0) globally on my .emacs and it works. I don't think this is a good general solution, but it's OK for me. Thanks!

inglada avatar May 07 '12 09:05 inglada

Hi @inglada and @unhammer, I'm sorry for my late response.

Because I'm not a heavy orgmode, your advices are very helpful! If org-deadline-warning-days=0 is needed for calfw-org for everyone, I would add the code.

Will you tell me some advice for this issue?

kiwanami avatar May 21 '12 02:05 kiwanami

Create your own cfw:open-org-calendar function to be called as a custom command and and make sure (cfw:open-org-calendar) is called with org-deadline-warning-days set to 0 by explicitely binding it to 0 before calling it. Then, assuming the (cfw:open-org-calendar) switches to the calendar buffer (which it does for now in 1.3+git20111208-1). Set the variables you want remembered local in its buffer. Its works for me.

(defun konix/cfw:open-org-calendar (&rest args) (interactive) (let ( ;; do not duplicate deadlines (org-deadline-warning-days 0) ) (cfw:open-org-calendar) ) ;; set the org variables to remember (set (make-variable-buffer-local 'org-agenda-skip-function) org-agenda-skip-function) (set (make-variable-buffer-local 'org-deadline-warning-days) org-deadline-warning-days) )

Konubinix avatar Oct 04 '12 08:10 Konubinix

I forgot to mention the remembering of the variable is useful for the configuration to remain when you update the calendar with "r"

Konubinix avatar Oct 04 '12 09:10 Konubinix

@Konubinix Thank you for your comment!

kiwanami avatar Oct 05 '12 00:10 kiwanami

This is a bit old, but I could not find a really convincing answer to this question: how could I generate different calfw-calendars with own functions in which

  1. I select some org files
  2. I restrict the headlines to some TODO keywords OR to some tag?

rogorido avatar Oct 09 '18 06:10 rogorido