Re: [O] Getting rid of split frame with org-capture

2013-10-04 Thread Alan Schmitt
alexander.vorob...@gmail.com writes:

 I also wanted to have new pop-up org-capture window that would be created
 in
 response to some shortcut anywhere in Windows and occupied the entire
 frame.
 Since I haven't found any solutions, I just modified a function I saw in
 this thread:

  (defun make-capture-frame ()
  Create a new frame and run org-capture.
  (interactive)
  (make-frame '((name . capture)))
  (select-frame-by-name capture)
  (delete-other-windows)
  (flet ((switch-to-buffer-other-window (buf) (switch-to-buffer
 buf)))
(org-capture)))

 The culprit is switch-to-buffer-other-window that ultimately gets called by
 org-capture so I just reassign it temporarily to switch-to-buffer.

This is working great, thanks a lot!

Alan



Re: [O] Getting rid of split frame with org-capture

2013-10-03 Thread Alexander Vorobiev
I also wanted to have new pop-up org-capture window that would be created
in
response to some shortcut anywhere in Windows and occupied the entire
frame.
Since I haven't found any solutions, I just modified a function I saw in
this thread:

 (defun make-capture-frame ()
 Create a new frame and run org-capture.
 (interactive)
 (make-frame '((name . capture)))
 (select-frame-by-name capture)
 (delete-other-windows)
 (flet ((switch-to-buffer-other-window (buf) (switch-to-buffer
buf)))
   (org-capture)))

The culprit is switch-to-buffer-other-window that ultimately gets called by
org-capture so I just reassign it temporarily to switch-to-buffer.

Then I use AutoHotkey to create a shortcut that would call emacsclient with
the new function. I am experimenting with AutoHotkey to construct
application-dependent org-mode-style links on the clipboard so that I can
use %x parameter in my capture templates to insert them. The current
version
of my AutoHotkey script creates links when in Google Chrome or Excel:

https://github.com/alexvorobiev/autohotkey/blob/master/AutoHotkey.ahk

The shortcut is Win-`

Regards,
Alex



On Wed, Dec 14, 2011 at 10:37 AM, Tom Prince tom.pri...@ualberta.netwrote:

 On Wed, 14 Dec 2011 00:11:11 +0100, Andreas Leha 
 andreas.l...@med.uni-goettingen.de wrote:
  While it works well on my emacs23, the emacs24 snapshot from
  http://emacs.naquadah.org/ crashes, when I select a template.  Is this a
  general issue with emacs24?  Ideas to adapt the snippet to work with
  emacs24?

 What do you mean by crash? Does the emacs process exit? In that case, I
 would try reporting the problem to some emacs forum ... I don't think
 emacs should be crashing given any elisp code, certainly not this code.

   Tom




Re: [O] Getting rid of split frame with org-capture

2011-12-16 Thread Tom Prince
On Wed, 14 Dec 2011 00:11:11 +0100, Andreas Leha 
andreas.l...@med.uni-goettingen.de wrote:
 While it works well on my emacs23, the emacs24 snapshot from
 http://emacs.naquadah.org/ crashes, when I select a template.  Is this a
 general issue with emacs24?  Ideas to adapt the snippet to work with
 emacs24?

What do you mean by crash? Does the emacs process exit? In that case, I
would try reporting the problem to some emacs forum ... I don't think
emacs should be crashing given any elisp code, certainly not this code.

  Tom



Re: [O] Getting rid of split frame with org-capture

2011-11-25 Thread Eric S Fraga
Nick Dokos nicholas.do...@hp.com writes:


 OT rant

 org-protocol is below my horizon :-) I had gotten it working a long time
 ago, then something happened in ff and broke it, I fixed it, they broke
 it again and at some point I gave up: every time I had to fix it, I

I so sympathise with you!  I gave up on capture from ff for exactly this
reason.  Keyboard based cut'n'paste does the job with only a couple more
keystrokes in the end (C-l C-c M-tab C-c c n C-y C-c C-c).  Well, with
appropriate number of M-Tabs... YMMV, of course!

 feature. Similar remarks apply to the improvements of Unity and Gnome
 3: a plague a' both their houses. All I need the damn desktop to do is
 open emacs when I click on the icon and give me enough workspaces for my
 needs (which vary). 

which is why I use ratpoison with C-t e opening up Emacs... ;-)

 Ah, I feel better now...

 /OT rant

As do I!  Thanks.

Apologies for the noise.

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.90.1
: using Org-mode version 7.7 (release_7.7.598.g4e2a)



Re: [O] Getting rid of split frame with org-capture

2011-11-20 Thread Tom Prince
On Sun, 13 Nov 2011 12:57:21 -0500, Nick Dokos nicholas.do...@hp.com wrote:
  1) If I don't pass -c to emacsclient, then I need to search all my
 workspaces to find where emacs decided to put the capture frame
  2) If I pass do pass -c to emacsclient, then I need to close the frame
 afterwards. And more significantly, I need to close the empty frame
 when I use store-link instead. (I could work around this by using
 seperate protocols for for each)
  
 
 Sounds like a worthwhile thing to fix - patches would probably be
 welcome.

I came up with the following hack, which seems to do what I want:

(defadvice org-protocol-check-filename-for-protocol (around 
tp/org-protocol-make-frame activate)
  Advice org-protocol-check-filename-for-protocol to open windows in new 
frames.
  (flet ((org-switch-to-buffer-other-window (rest args) ; for org-mks
(let ((pop-up-frames t))
  (apply 'switch-to-buffer-other-window args)))
 (org-pop-to-buffer-same-window (rest args)  ; for org-capture
(let ((pop-up-frames t))
  (apply 'switch-to-buffer-other-window args
(let ((display-buffer-mark-dedicated t))
  ad-do-it)))



Re: [O] Getting rid of split frame with org-capture

2011-11-13 Thread Tom Prince
On Sat, 12 Nov 2011 23:13:11 -0500, Nick Dokos nicholas.do...@hp.com wrote:
 Not worth the bother IMO[fn:1], but if you wish to implement it and submit
 a patch, I'd be happy to review it.
 
 Nick
 
 Footnotes:
 
 [fn:1] Remember, capture is supposed to be as unobtrusive as possible:
you just want to squirrel away something for future
reference. Bells and whistles (which, IMO, this change would be)
are not the point: you want to get in, record the data and get
out and back to work as fast as possible. Popping up frames slows
things down but more importantly jolts you away from what you
were doing. At least, it would me (I think): that's why I don't
think it's worth it, but you may very well disagree.

It isn't worth *if* capture is invoked from emacs. If capture is invoked
from org-protocol in firefox, then there might not even be a emacs frame
visible.

1) If I don't pass -c to emacsclient, then I need to search all my
   workspaces to find where emacs decided to put the capture frame
2) If I pass do pass -c to emacsclient, then I need to close the frame
   afterwards. And more significantly, I need to close the empty frame
   when I use store-link instead. (I could work around this by using
   seperate protocols for for each)

 Tom



Re: [O] Getting rid of split frame with org-capture

2011-11-13 Thread Nick Dokos
Tom Prince tom.pri...@ualberta.net wrote:

 On Sat, 12 Nov 2011 23:13:11 -0500, Nick Dokos nicholas.do...@hp.com wrote:
  Not worth the bother IMO[fn:1], but if you wish to implement it and submit
  a patch, I'd be happy to review it.
  
  Nick
  
  Footnotes:
  
  [fn:1] Remember, capture is supposed to be as unobtrusive as possible:
 you just want to squirrel away something for future
 reference. Bells and whistles (which, IMO, this change would be)
 are not the point: you want to get in, record the data and get
 out and back to work as fast as possible. Popping up frames slows
 things down but more importantly jolts you away from what you
 were doing. At least, it would me (I think): that's why I don't
 think it's worth it, but you may very well disagree.
 
 It isn't worth *if* capture is invoked from emacs. If capture is invoked
 from org-protocol in firefox, then there might not even be a emacs frame
 visible.
 

OT rant

org-protocol is below my horizon :-) I had gotten it working a long time
ago, then something happened in ff and broke it, I fixed it, they broke
it again and at some point I gave up: every time I had to fix it, I had
to go back and relearn everything (it's not as if I live and breathe ff
arcana) and do a few hours' worth of research and then try a few dozen
times, tweaking this and that because all the instructions were either
outdated or inconsistent - if they are not respectful enough of the
thousands of people that used the feature that they broke and not
cognizant of the pain they produce, I will not use their damn
feature. Similar remarks apply to the improvements of Unity and Gnome
3: a plague a' both their houses. All I need the damn desktop to do is
open emacs when I click on the icon and give me enough workspaces for my
needs (which vary). I'd rather do cut-n-paste than waste another second
on org-protocol (mind you, it's not org-protocol's problem: it's the
other side that breaks - but without the other side, org-protocol is
almost useless).

Ah, I feel better now...

/OT rant

 1) If I don't pass -c to emacsclient, then I need to search all my
workspaces to find where emacs decided to put the capture frame
 2) If I pass do pass -c to emacsclient, then I need to close the frame
afterwards. And more significantly, I need to close the empty frame
when I use store-link instead. (I could work around this by using
seperate protocols for for each)
 

Sounds like a worthwhile thing to fix - patches would probably be welcome.

Nick




Re: [O] Getting rid of split frame with org-capture

2011-11-13 Thread Nick Dokos
Thomas Lockney tho...@lockney.net wrote:

 I'm attempting to get some code working that should create a new frame
 with *just* org-capture, but when I run it, I keep getting a split
 despite various attempts at running delete-other-windows. I'm running
 on GNU Emacs 24.0.90.1 (i386-apple-darwin10.8.0, NS
 apple-appkit-1038.36) so perhaps this is a 24 specific issue. Here's
 the code I've currently got:
 
 (defadvice org-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 org-capture-destroy (after delete-capture-frame activate)
   Advise capture-destroy to close the frame if it is the capture frame
   (if (equal capture (frame-parameter nil 'name))
   (delete-frame)))
 
 (defun make-capture-frame ()
   Create a new frame and run org-capture.
   (interactive)
   (make-frame '((name . Capture)
 (width . 100)
 (height . 15)))
   (select-frame-by-name Capture)
   (delete-other-windows)
   (org-capture))
 
 I've also tried this using the org-capture-mode-hook to call
 delete-other-windows and I've tried placing delete-other-windows after
 the call to org-capture (both of those based on solutions I've seen
 posted to this list at various times). Anyone have any clues on this?
 I'm stumped, but I'm also fairly inexperienced at programming emacs.
 

As I pointed out in my reply to Gregor, org-capture will split the frame,
no matter whether you have a new one or not: you need to modify its innards
to change that behavior.

Aside from that, there is a problem here: you name the frame
Capture, yet you test (equal capture ...) - I presume that's a typo?

Nick



Re: [O] Getting rid of split frame with org-capture

2011-11-12 Thread Gregor Zattler
Hi Thomas, org-mode community,
* Thomas Lockney tho...@lockney.net [10. Nov. 2011]:
 I'm attempting to get some code working that should create a new frame
 with *just* org-capture, 

this is something I also tried hard to achive.

 but when I run it, I keep getting a split
 despite various attempts at running delete-other-windows. I'm running
 on GNU Emacs 24.0.90.1 (i386-apple-darwin10.8.0, NS
 apple-appkit-1038.36) so perhaps this is a 24 specific issue. Here's
 the code I've currently got:
 
 (defadvice org-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 org-capture-destroy (after delete-capture-frame activate)
   Advise capture-destroy to close the frame if it is the capture frame
   (if (equal capture (frame-parameter nil 'name))
   (delete-frame)))
 
 (defun make-capture-frame ()
   Create a new frame and run org-capture.
   (interactive)
   (make-frame '((name . Capture)
 (width . 100)
 (height . 15)))
   (select-frame-by-name Capture)
   (delete-other-windows)
   (org-capture))

I played a bit with your code.  I also use emacs24.  I also get a
split frame.  I think it's org-capture which splits the frame.

I want to run this with emacsclient.  But when there is no
graphical (X11) frame then emacsclient -e '(make-capture-frame)'
does nothing, no frame pops up. 

 I've also tried this using the org-capture-mode-hook to call
 delete-other-windows and I've tried placing delete-other-windows after
 the call to org-capture (both of those based on solutions I've seen
 posted to this list at various times). Anyone have any clues on this?
 I'm stumped, but I'm also fairly inexperienced at programming
 emacs.

me too.  For my capture needs I would like to automatically open a frame for
org-capture and also automatically close it when finishing the
capture.  This should happen regardless of other frames or the
lack of other frames.

Ciao, Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-



Re: [O] Getting rid of split frame with org-capture

2011-11-12 Thread Nick Dokos
Gregor Zattler telegr...@gmx.net wrote:

 Hi Thomas, org-mode community,
 * Thomas Lockney tho...@lockney.net [10. Nov. 2011]:
  I'm attempting to get some code working that should create a new frame
  with *just* org-capture, 
 
 this is something I also tried hard to achive.
 
  but when I run it, I keep getting a split
  despite various attempts at running delete-other-windows. I'm running
  on GNU Emacs 24.0.90.1 (i386-apple-darwin10.8.0, NS
  apple-appkit-1038.36) so perhaps this is a 24 specific issue. Here's
  the code I've currently got:
  
  (defadvice org-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 org-capture-destroy (after delete-capture-frame activate)
Advise capture-destroy to close the frame if it is the capture frame
(if (equal capture (frame-parameter nil 'name))
(delete-frame)))
  
  (defun make-capture-frame ()
Create a new frame and run org-capture.
(interactive)
(make-frame '((name . Capture)
  (width . 100)
  (height . 15)))
(select-frame-by-name Capture)
(delete-other-windows)
(org-capture))
 
 I played a bit with your code.  I also use emacs24.  I also get a
 split frame.  I think it's org-capture which splits the frame.
 
 I want to run this with emacsclient.  But when there is no
 graphical (X11) frame then emacsclient -e '(make-capture-frame)'
 does nothing, no frame pops up. 
 
  I've also tried this using the org-capture-mode-hook to call
  delete-other-windows and I've tried placing delete-other-windows after
  the call to org-capture (both of those based on solutions I've seen
  posted to this list at various times). Anyone have any clues on this?
  I'm stumped, but I'm also fairly inexperienced at programming
  emacs.
 
 me too.  For my capture needs I would like to automatically open a frame for
 org-capture and also automatically close it when finishing the
 capture.  This should happen regardless of other frames or the
 lack of other frames.
 

AFAICT, this is not possible with the current code. The above is
attacking the problem at the wrong level: you can't change that behavior
from the outside; you need to change the existing code in order to
implement it.

If you wish to hack, the relevant function is
org-capture-place-template: changing the
org-switch-to-buffer-other-window to org-switch-to-buffer-other-frame
(and adding a definition for the latter function in analogy to the
former) would indeed pop up a frame and you can enter your capture and
finalize it - that's the easy part.

But note that org-capture-finalize would need a tweak too in order to
delete the now useless frame.

And of course all of this would need to be done conditionally based
on a new user option, perhaps org-capture-in-new-frame (nil by default).
And don't forget to make it customizable.

Not worth the bother IMO[fn:1], but if you wish to implement it and submit
a patch, I'd be happy to review it.

Nick

Footnotes:

[fn:1] Remember, capture is supposed to be as unobtrusive as possible:
   you just want to squirrel away something for future
   reference. Bells and whistles (which, IMO, this change would be)
   are not the point: you want to get in, record the data and get
   out and back to work as fast as possible. Popping up frames slows
   things down but more importantly jolts you away from what you
   were doing. At least, it would me (I think): that's why I don't
   think it's worth it, but you may very well disagree.



[O] Getting rid of split frame with org-capture

2011-11-10 Thread Thomas Lockney
I'm attempting to get some code working that should create a new frame
with *just* org-capture, but when I run it, I keep getting a split
despite various attempts at running delete-other-windows. I'm running
on GNU Emacs 24.0.90.1 (i386-apple-darwin10.8.0, NS
apple-appkit-1038.36) so perhaps this is a 24 specific issue. Here's
the code I've currently got:

(defadvice org-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 org-capture-destroy (after delete-capture-frame activate)
  Advise capture-destroy to close the frame if it is the capture frame
  (if (equal capture (frame-parameter nil 'name))
  (delete-frame)))

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

I've also tried this using the org-capture-mode-hook to call
delete-other-windows and I've tried placing delete-other-windows after
the call to org-capture (both of those based on solutions I've seen
posted to this list at various times). Anyone have any clues on this?
I'm stumped, but I'm also fairly inexperienced at programming emacs.

-- 
http://about.me/tlockney