[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: If arg, open in new frame
From: |
Tory S. Anderson |
Subject: |
Re: If arg, open in new frame |
Date: |
Thu, 11 Sep 2014 06:58:51 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Almost perfect! Thanks! One case is missed in your code: if buffer does not yet
exist, it cannot be opened in a new frame. I tried this to no avail:
(defun go-or-make-agenda (&optional new-frame)
(interactive "P")
(let ((buffer "\*Org Agenda\*"))
(if (get-buffer buffer)
(if new-frame
(switch-to-buffer-other-frame buffer)
(switch-to-buffer buffer))
(if new-frame
(switch-to-buffer-other-frame org-agenda-list) ;; not a buffer
(org-agenda-list)))))
With all this switch-to-buffer redundancy, what I'd REALLY like to do is
conditionally bind the function to a variable based on (if new-frame) but I'll
make that a new thread.
So now, How can I run org-agenda-list in a new frame if buffer does not exist?
Thanks
Rusi <rustompmody@gmail.com> writes:
> On Wednesday, September 10, 2014 5:32:30 PM UTC+5:30, Tory S. Anderson wrote:
>> So, that half answered my question: thanks for showing me how to use
>> optional args. My function is now:
>
>> (defun go-or-make-agenda (&optional new-frame) (interactive "P")
>> (let ((buffer "\*Org Agenda\*"))
>> (if (get-buffer buffer)
>> (switch-to-buffer buffer)
>> (org-agenda-list))))
>
> Does this help?
>
> (defun go-or-make-agenda (&optional new-frame)
> (interactive "P")
> (let ((buffer "\*Org Agenda\*"))
> (if (get-buffer buffer)
> (if new-frame
> (switch-to-buffer-other-frame buffer)
> (switch-to-buffer buffer))
> (org-agenda-list))))
- If arg, open in new frame, Tory S. Anderson, 2014/09/09
- Re: If arg, open in new frame, Emanuel Berg, 2014/09/09
- RE: If arg, open in new frame, Tory S. Anderson, 2014/09/10
- Re: If arg, open in new frame, Emanuel Berg, 2014/09/10
- Re: If arg, open in new frame, Rusi, 2014/09/10
- Re: If arg, open in new frame,
Tory S. Anderson <=