emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-capture-hook only when in frame?


From: Micah Anderson
Subject: Re: [O] org-capture-hook only when in frame?
Date: Tue, 20 Sep 2011 20:21:32 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Tom Prince <address@hidden> writes:

> On Tue, 20 Sep 2011 18:45:31 -0400, Micah Anderson <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]