emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-capture-hook only when in frame?
@ 2011-09-20 22:45 Micah Anderson
  2011-09-20 23:55 ` Tom Prince
  0 siblings, 1 reply; 4+ messages in thread
From: Micah Anderson @ 2011-09-20 22:45 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 765 bytes --]


I have a function to create a frame for capture mode that I can call
with emacsclient at any time:

;; Initialization of capture frames
(defun make-capture-frame ()
  "Create a new frame and run org-capture"
  (interactive)  
  (make-frame '((name . "capture") (width . 80) (height . 10)))
  (select-frame-by-name "capture")
  ;; Org-remember splits windows, force it to a single window
  (add-hook 'org-capture-mode-hook  'delete-other-windows)
  (org-capture)
)

This works great, however I actually would like org-capture-mode to
split the screen when I am *not* calling this function, but it seems
like when I have this existing, it deletes the other window even when I
am inside the original emacs.

thanks for any hints!
micah

-- 


[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: org-capture-hook only when in frame?
  2011-09-20 22:45 org-capture-hook only when in frame? Micah Anderson
@ 2011-09-20 23:55 ` Tom Prince
  2011-09-21  0:21   ` Micah Anderson
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Prince @ 2011-09-20 23:55 UTC (permalink / raw)
  To: Micah Anderson, emacs-orgmode

On Tue, 20 Sep 2011 18:45:31 -0400, Micah Anderson <micah@riseup.net> wrote:
Non-text part: multipart/signed
> 
> I have a function to create a frame for capture mode that I can call
> with emacsclient at any time:
> 
> ;; Initialization of capture frames
> (defun make-capture-frame ()
>   "Create a new frame and run org-capture"
>   (interactive)  
>   (make-frame '((name . "capture") (width . 80) (height . 10)))
>   (select-frame-by-name "capture")
>   ;; Org-remember splits windows, force it to a single window
(let ((org-capture-mode-hook))
>   (add-hook 'org-capture-mode-hook  'delete-other-windows)
>   (org-capture)
    )
> )
Would probably work, although there may be better ways.

  Tom

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

* Re: org-capture-hook only when in frame?
  2011-09-20 23:55 ` Tom Prince
@ 2011-09-21  0:21   ` Micah Anderson
  2011-09-21  0:24     ` Micah Anderson
  0 siblings, 1 reply; 4+ messages in thread
From: Micah Anderson @ 2011-09-21  0:21 UTC (permalink / raw)
  To: emacs-orgmode

Tom Prince <tom.prince@ualberta.net> writes:

> On Tue, 20 Sep 2011 18:45:31 -0400, Micah Anderson <micah@riseup.net> wrote:
> Non-text part: multipart/signed
>> 
>> I have a function to create a frame for capture mode that I can call
>> with emacsclient at any time:
>> 
>> ;; Initialization of capture frames
>> (defun make-capture-frame ()
>>   "Create a new frame and run org-capture"
>>   (interactive)  
>>   (make-frame '((name . "capture") (width . 80) (height . 10)))
>>   (select-frame-by-name "capture")
>>   ;; Org-remember splits windows, force it to a single window
> (let ((org-capture-mode-hook))
>>   (add-hook 'org-capture-mode-hook  'delete-other-windows)
>>   (org-capture)
>     )
>> )
> Would probably work, although there may be better ways.

Actually, it seems like I didn't need to do the hook at all, I just had
to put a (delete-other-window) after the (org-capture), like this:


(defun make-capture-frame ()
  "Create a new frame and run org-capture."
  (interactive)
  (make-frame '((name . "capture") (width . 80 ) (height . 10)))
  (select-frame-by-name "capture")
  (org-capture)
  (delete-other-windows)
  )

Now I am trying to get the frame to be destroyed after I've either
canceled, or saved the capture, I found these referenced on the mailing
list, and I've added them and loaded them, but for some reason they
aren't working:

(defadvice capture-finalize (after delete-capture-frame activate)
  "Advise capture-finalize to close the frame if it is the capture frame"
  (if (equal "capture" (frame-parameter nil 'name))
      (delete-frame)))

(defadvice capture-destroy (after delete-capture-frame activate)
  "Advise capture-destroy to close the frame if it is the rememeber frame"
  (if (equal "capture" (frame-parameter nil 'name))
      (delete-frame)))

what happens is I get the frame, I get the org-capture template, I enter
my item, I finalize it, and then I'm switched back to the scratch
buffer, rather than the frame being destroyed :P

micah

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

* Re: org-capture-hook only when in frame?
  2011-09-21  0:21   ` Micah Anderson
@ 2011-09-21  0:24     ` Micah Anderson
  0 siblings, 0 replies; 4+ messages in thread
From: Micah Anderson @ 2011-09-21  0:24 UTC (permalink / raw)
  To: emacs-orgmode

Micah Anderson <micah@riseup.net> writes:

>
> (defadvice capture-finalize (after delete-capture-frame activate)
>   "Advise capture-finalize to close the frame if it is the capture frame"
>   (if (equal "capture" (frame-parameter nil 'name))
>       (delete-frame)))
>
> (defadvice capture-destroy (after delete-capture-frame activate)
>   "Advise capture-destroy to close the frame if it is the rememeber frame"
>   (if (equal "capture" (frame-parameter nil 'name))
>       (delete-frame)))

arg, these should be org-capture-finalize and
org-capture-destroy... thats my problem. Sorry for the noise :)

micah

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

end of thread, other threads:[~2011-09-21  0:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-20 22:45 org-capture-hook only when in frame? Micah Anderson
2011-09-20 23:55 ` Tom Prince
2011-09-21  0:21   ` Micah Anderson
2011-09-21  0:24     ` Micah Anderson

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