* [Sticky Agenda] How to create Agenda Buffers in functions
@ 2012-04-03 17:10 Sven Bretfeld
2012-04-04 0:23 ` Max Mikhanosha
0 siblings, 1 reply; 5+ messages in thread
From: Sven Bretfeld @ 2012-04-03 17:10 UTC (permalink / raw)
To: emacs-org
Hi all
The Sticky Agenda is something I have been waiting for since a long
time. Thank you very much!
I want to write a function that creates a new frame with several
windows, each displaying a different Agenda Views. I fail to find a
function that creates special agenda views. Formerly I used
org-batch-agenda for similar purposes. But that doesn't work in the
sticky branch. This is what I have:
(defun my-gtd-frame ()
(interactive)
(save-excursion)
(make-frame '(
(name . "gtd")
(active-alpha . 0.75)
(inactive-alpha . 0.8)
(top . 110)
(left . 2000)
(width . 80)
(height . 40)
(font . "-Adobe-Courier-Medium-R-Normal--18-180-75-75-M-110-ISO8859-1")))
(select-frame-by-name "gtd")
(toggle-fullscreen)
(org-agenda-goto-today)
(delete-other-windows)
(split-window-horizontally)
(other-window 1)
(org-batch-agenda "OFFICE/NEXT")
)
Calling this function should create a fullscreen Emacs frame on my
second monitor vertically split into two windows. The upper window
should display the week-agenda (org-agenda-goto-today), the lower window
should contain a special-agenda-view showing all items with the
todo-keyword NEXT and the tag OFFICE.
Everything works as expected until it comes to the last line.
org-batch-agenda seems not to be the correct function to be called here.
The minibuffer says: "No catch for tag: exit, nil".
Can anybody help?
Thanks
Sven
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Sticky Agenda] How to create Agenda Buffers in functions
2012-04-03 17:10 [Sticky Agenda] How to create Agenda Buffers in functions Sven Bretfeld
@ 2012-04-04 0:23 ` Max Mikhanosha
2012-04-04 5:30 ` Sven Bretfeld
2012-04-19 20:17 ` Sebastien Vauban
0 siblings, 2 replies; 5+ messages in thread
From: Max Mikhanosha @ 2012-04-04 0:23 UTC (permalink / raw)
To: emacs-orgmode
At 3 Apr 2012 19:10:30 +0200,
Sven Bretfeld wrote:
>
> Hi all
>
> The Sticky Agenda is something I have been waiting for since a long
> time. Thank you very much!
>
> I want to write a function that creates a new frame with several
> windows, each displaying a different Agenda Views. I fail to find a
> function that creates special agenda views. Formerly I used
> org-batch-agenda for similar purposes. But that doesn't work in the
> sticky branch. This is what I have:
>
> (defun my-gtd-frame ()
> (interactive)
> (save-excursion)
> (make-frame '(
> (name . "gtd")
> (active-alpha . 0.75)
> (inactive-alpha . 0.8)
> (top . 110)
> (left . 2000)
> (width . 80)
> (height . 40)
> (font . "-Adobe-Courier-Medium-R-Normal--18-180-75-75-M-110-ISO8859-1")))
> (select-frame-by-name "gtd")
> (toggle-fullscreen)
> (org-agenda-goto-today)
> (delete-other-windows)
> (split-window-horizontally)
> (other-window 1)
> (org-batch-agenda "OFFICE/NEXT")
> )
>
This is the same bug as Martyn Jago reported earlier, basically I
forgot that separate org agenda commands can be run individually
rather then through (org-agenda) function.
A temporary workaround in your specific case would be to wrap
(org-batch-agenda) call like this:
(catch 'exit
(org-batch-agenda "OFFICE/NEXT"))
I tested it and it seems to work.. The actual fix for the bug will be
similar and will be wrapping bodies of (org-todo-list) (org-tags-list)
and friends with (catch 'exit), but it needs to be done conditionally
as to only do it its called individually and not from (org-agenda)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Sticky Agenda] How to create Agenda Buffers in functions
2012-04-04 0:23 ` Max Mikhanosha
@ 2012-04-04 5:30 ` Sven Bretfeld
2012-04-19 20:17 ` Sebastien Vauban
1 sibling, 0 replies; 5+ messages in thread
From: Sven Bretfeld @ 2012-04-04 5:30 UTC (permalink / raw)
To: emacs-org, max
Max Mikhanosha <max@openchat.com> writes:
> This is the same bug as Martyn Jago reported earlier, basically I
> forgot that separate org agenda commands can be run individually
> rather then through (org-agenda) function.
>
> A temporary workaround in your specific case would be to wrap
> (org-batch-agenda) call like this:
>
> (catch 'exit
> (org-batch-agenda "OFFICE/NEXT"))
>
> I tested it and it seems to work.. The actual fix for the bug will be
> similar and will be wrapping bodies of (org-todo-list) (org-tags-list)
> and friends with (catch 'exit), but it needs to be done conditionally
> as to only do it its called individually and not from (org-agenda)
I see. Thank you for hinting me to a workaround.
Sven
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Sticky Agenda] How to create Agenda Buffers in functions
2012-04-04 0:23 ` Max Mikhanosha
2012-04-04 5:30 ` Sven Bretfeld
@ 2012-04-19 20:17 ` Sebastien Vauban
2012-04-20 1:39 ` Max Mikhanosha
1 sibling, 1 reply; 5+ messages in thread
From: Sebastien Vauban @ 2012-04-19 20:17 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Max,
Max Mikhanosha wrote:
> Sven Bretfeld wrote:
>> The Sticky Agenda is something I have been waiting for since a long
>> time. Thank you very much!
Let me thank you for the sticky agenda as well. I can't say I'm using multiple
agendas in parallel -- while I'll surely make more use of it --, but the fact
that the agenda view comes almost instataneously is really great!
>> I want to write a function that creates a new frame with several
>> windows, each displaying a different Agenda Views. I fail to find a
>> function that creates special agenda views. Formerly I used
>> org-batch-agenda for similar purposes. But that doesn't work in the
>> sticky branch. This is what I have:
>>
>> (defun my-gtd-frame ()
>> (interactive)
>> (save-excursion)
>> (make-frame '(
>> (name . "gtd")
>> (active-alpha . 0.75)
>> (inactive-alpha . 0.8)
>> (top . 110)
>> (left . 2000)
>> (width . 80)
>> (height . 40)
>> (font . "-Adobe-Courier-Medium-R-Normal--18-180-75-75-M-110-ISO8859-1")))
>> (select-frame-by-name "gtd")
>> (toggle-fullscreen)
>> (org-agenda-goto-today)
>> (delete-other-windows)
>> (split-window-horizontally)
>> (other-window 1)
>> (org-batch-agenda "OFFICE/NEXT")
>> )
>
> This is the same bug as Martyn Jago reported earlier, basically I
> forgot that separate org agenda commands can be run individually
> rather then through (org-agenda) function.
>
> A temporary workaround in your specific case would be to wrap
> (org-batch-agenda) call like this:
>
> (catch 'exit
> (org-batch-agenda "OFFICE/NEXT"))
>
> I tested it and it seems to work.. The actual fix for the bug will be
> similar and will be wrapping bodies of (org-todo-list) (org-tags-list)
> and friends with (catch 'exit), but it needs to be done conditionally
> as to only do it its called individually and not from (org-agenda)
I tried the updated version of Sven:
#+begin_src emacs-lisp
(defun my-gtd-frame ()
(interactive)
(save-excursion)
(make-frame '(
(name . "gtd")
(active-alpha . 0.75)
(inactive-alpha . 0.8)
(top . 20)
(left . 20)
(width . 80)
(height . 40)))
(select-frame-by-name "gtd")
(org-agenda-goto-today)
(delete-other-windows)
(split-window-horizontally)
(other-window 1)
(catch 'exit
(org-batch-agenda "work")))
#+end_src
But I get the following error:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "Not allowed in nil-type agenda buffers")
signal(error ("Not allowed in nil-type agenda buffers"))
error("Not allowed in %s-type agenda buffers" nil)
(if error (error "Not allowed in %s-type agenda buffers" org-agenda-type) nil)
(if (memq org-agenda-type types) t (if error (error "Not allowed in %s-type agenda buffers" org-agenda-type) nil))
org-agenda-check-type(t timeline agenda)
org-agenda-goto-today()
my-gtd-frame()
call-interactively(my-gtd-frame)
(let* ((command (helm-comp-read "M-x " obarray :test (quote commandp) :requires-pattern helm-M-x-requires-pattern :name "Emacs Commands" :buffer "*helm M-x*" :persistent-action (quote pers-help) :persistent-help "Describe this command" :history history :must-match t :candidates-in-buffer t :fc-transformer (quote helm-M-x-transformer))) (sym-com (intern command))) (unless current-prefix-arg (setq current-prefix-arg helm-current-prefix-arg)) (setq this-command sym-com) (call-interactively sym-com) (setq extended-command-history (cons command (delete command history))))
(progn (fset (quote pers-help) (function* (lambda (candidate) (block pers-help (let ((hbuf ...)) (if (and in-help ...) (progn ... ...) (set-window-dedicated-p ... nil) (describe-function ...) (message nil) (setq in-help t)) (setq help-cand candidate)))))) (let* ((command (helm-comp-read "M-x " obarray :test (quote commandp) :requires-pattern helm-M-x-requires-pattern :name "Emacs Commands" :buffer "*helm M-x*" :persistent-action (quote pers-help) :persistent-help "Describe this command" :history history :must-match t :candidates-in-buffer t :fc-transformer (quote helm-M-x-transformer))) (sym-com (intern command))) (unless current-prefix-arg (setq current-prefix-arg helm-current-prefix-arg)) (setq this-command sym-com) (call-interactively sym-com) (setq extended-command-history (cons command (delete command history)))))
(unwind-protect (progn (fset (quote pers-help) (function* (lambda (candidate) (block pers-help (let (...) (if ... ... ... ... ... ...) (setq help-cand candidate)))))) (let* ((command (helm-comp-read "M-x " obarray :test (quote commandp) :requires-pattern helm-M-x-requires-pattern :name "Emacs Commands" :buffer "*helm M-x*" :persistent-action (quote pers-help) :persistent-help "Describe this command" :history history :must-match t :candidates-in-buffer t :fc-transformer (quote helm-M-x-transformer))) (sym-com (intern command))) (unless current-prefix-arg (setq current-prefix-arg helm-current-prefix-arg)) (setq this-command sym-com) (call-interactively sym-com) (setq extended-command-history (cons command (delete command history))))) (if --cl-letf-bound-- (fset (quote pers-help) --cl-letf-save--) (fmakunbound (quote pers-help))))
(let* ((--cl-letf-bound-- (fboundp (quote pers-help))) (--cl-letf-save-- (and --cl-letf-bound-- (symbol-function (quote pers-help))))) (unwind-protect (progn (fset (quote pers-help) (function* (lambda (candidate) (block pers-help (let ... ... ...))))) (let* ((command (helm-comp-read "M-x " obarray :test (quote commandp) :requires-pattern helm-M-x-requires-pattern :name "Emacs Commands" :buffer "*helm M-x*" :persistent-action (quote pers-help) :persistent-help "Describe this command" :history history :must-match t :candidates-in-buffer t :fc-transformer (quote helm-M-x-transformer))) (sym-com (intern command))) (unless current-prefix-arg (setq current-prefix-arg helm-current-prefix-arg)) (setq this-command sym-com) (call-interactively sym-com) (setq extended-command-history (cons command (delete command history))))) (if --cl-letf-bound-- (fset (quote pers-help) --cl-letf-save--) (fmakunbound (quote pers-help)))))
(letf (((symbol-function (quote pers-help)) (function* (lambda (candidate) (block pers-help (let (...) (if ... ... ... ... ... ...) (setq help-cand candidate))))))) (let* ((command (helm-comp-read "M-x " obarray :test (quote commandp) :requires-pattern helm-M-x-requires-pattern :name "Emacs Commands" :buffer "*helm M-x*" :persistent-action (quote pers-help) :persistent-help "Describe this command" :history history :must-match t :candidates-in-buffer t :fc-transformer (quote helm-M-x-transformer))) (sym-com (intern command))) (unless current-prefix-arg (setq current-prefix-arg helm-current-prefix-arg)) (setq this-command sym-com) (call-interactively sym-com) (setq extended-command-history (cons command (delete command history)))))
(letf* (((symbol-function (quote pers-help)) (function* (lambda (candidate) (block pers-help (let (...) (if ... ... ... ... ... ...) (setq help-cand candidate))))))) (let* ((command (helm-comp-read "M-x " obarray :test (quote commandp) :requires-pattern helm-M-x-requires-pattern :name "Emacs Commands" :buffer "*helm M-x*" :persistent-action (quote pers-help) :persistent-help "Describe this command" :history history :must-match t :candidates-in-buffer t :fc-transformer (quote helm-M-x-transformer))) (sym-com (intern command))) (unless current-prefix-arg (setq current-prefix-arg helm-current-prefix-arg)) (setq this-command sym-com) (call-interactively sym-com) (setq extended-command-history (cons command (delete command history)))))
(flet ((pers-help (candidate) (let ((hbuf (get-buffer (help-buffer)))) (if (and in-help (string= candidate help-cand)) (progn (unless (equal hbuf helm-current-buffer) (kill-buffer hbuf)) (setq in-help nil)) (set-window-dedicated-p (get-buffer-window helm-current-buffer) nil) (describe-function (intern candidate)) (message nil) (setq in-help t)) (setq help-cand candidate)))) (let* ((command (helm-comp-read "M-x " obarray :test (quote commandp) :requires-pattern helm-M-x-requires-pattern :name "Emacs Commands" :buffer "*helm M-x*" :persistent-action (quote pers-help) :persistent-help "Describe this command" :history history :must-match t :candidates-in-buffer t :fc-transformer (quote helm-M-x-transformer))) (sym-com (intern command))) (unless current-prefix-arg (setq current-prefix-arg helm-current-prefix-arg)) (setq this-command sym-com) (call-interactively sym-com) (setq extended-command-history (cons command (delete command history)))))
(let* (in-help help-cand special-display-buffer-names special-display-regexps helm-persistent-action-use-special-display (history (loop with hist for i in extended-command-history for com = (intern i) when (fboundp com) collect i into hist finally return hist))) (flet ((pers-help (candidate) (let ((hbuf (get-buffer ...))) (if (and in-help (string= candidate help-cand)) (progn (unless ... ...) (setq in-help nil)) (set-window-dedicated-p (get-buffer-window helm-current-buffer) nil) (describe-function (intern candidate)) (message nil) (setq in-help t)) (setq help-cand candidate)))) (let* ((command (helm-comp-read "M-x " obarray :test (quote commandp) :requires-pattern helm-M-x-requires-pattern :name "Emacs Commands" :buffer "*helm M-x*" :persistent-action (quote pers-help) :persistent-help "Describe this command" :history history :must-match t :candidates-in-buffer t :fc-transformer (quote helm-M-x-transformer))) (sym-com (intern command))) (unless current-prefix-arg (setq current-prefix-arg helm-current-prefix-arg)) (setq this-command sym-com) (call-interactively sym-com) (setq extended-command-history (cons command (delete command history))))))
helm-M-x()
call-interactively(helm-M-x nil nil)
--8<---------------cut here---------------end--------------->8---
Am I missing something?
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Sticky Agenda] How to create Agenda Buffers in functions
2012-04-19 20:17 ` Sebastien Vauban
@ 2012-04-20 1:39 ` Max Mikhanosha
0 siblings, 0 replies; 5+ messages in thread
From: Max Mikhanosha @ 2012-04-20 1:39 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: emacs-orgmode
At Thu, 19 Apr 2012 22:17:08 +0200,
Sebastien Vauban wrote:
> I tried the updated version of Sven:
>
> #+begin_src emacs-lisp
> (defun my-gtd-frame ()
> (interactive)
> (save-excursion)
> (make-frame '(
> (name . "gtd")
> (active-alpha . 0.75)
> (inactive-alpha . 0.8)
> (top . 20)
> (left . 20)
> (width . 80)
> (height . 40)))
> (select-frame-by-name "gtd")
> (org-agenda-goto-today)
> (delete-other-windows)
> (split-window-horizontally)
> (other-window 1)
> (catch 'exit
> (org-batch-agenda "work")))
> #+end_src
>
> But I get the following error:
>
> --8<---------------cut here---------------start------------->8---
> Debugger entered--Lisp error: (error "Not allowed in nil-type agenda buffers")
> signal(error ("Not allowed in nil-type agenda buffers"))
> error("Not allowed in %s-type agenda buffers" nil)
> (if error (error "Not allowed in %s-type agenda buffers" org-agenda-type) nil)
> (if (memq org-agenda-type types) t (if error (error "Not allowed in %s-type agenda buffers" org-agenda-type) nil))
> org-agenda-check-type(t timeline agenda)
> org-agenda-goto-today()
> my-gtd-frame()
> call-interactively(my-gtd-frame)
> ...
> Am I missing something?
>
The call to (org-agenda-goto-today) is before it created the agenda, I
think it should be inside the catch, after the (org-batch-agenda) call.
Regards,
Max
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-04-20 1:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-03 17:10 [Sticky Agenda] How to create Agenda Buffers in functions Sven Bretfeld
2012-04-04 0:23 ` Max Mikhanosha
2012-04-04 5:30 ` Sven Bretfeld
2012-04-19 20:17 ` Sebastien Vauban
2012-04-20 1:39 ` Max Mikhanosha
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).