From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xebar Saram Subject: Re: [feature request] org-capture-window-setup to stop capture window taking up whole frame Date: Thu, 18 Jun 2015 14:16:46 +0300 Message-ID: References: <87zj4ate9f.fsf@pinto.chemeng.ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b2e4fd87046e30518c8f1cb Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5XoP-0008Np-OQ for emacs-orgmode@gnu.org; Thu, 18 Jun 2015 07:16:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5XoN-00085n-Si for emacs-orgmode@gnu.org; Thu, 18 Jun 2015 07:16:49 -0400 Received: from mail-pd0-x234.google.com ([2607:f8b0:400e:c02::234]:33589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5XoN-00085X-G3 for emacs-orgmode@gnu.org; Thu, 18 Jun 2015 07:16:47 -0400 Received: by pdjn11 with SMTP id n11so64668136pdj.0 for ; Thu, 18 Jun 2015 04:16:46 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Alan Schmitt Cc: org mode --047d7b2e4fd87046e30518c8f1cb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Alan your code seems very intersting and i have been looking for something like this for a while. yet for me it opens a new frame without org capture. i use linux (arch) and put in the following code. please note that when i evaled your code it said: `flet' is an obsolete macro (as of 24.3); use either `cl-flet' or `cl-letf'= . so i changed flet to cl-flet and it still didnt work :) here is the code (defun make-orgcapture-frame () "Create a new frame and run org-capture." (interactive) (make-frame '((name . "remember") (width . 80) (height . 16) (top . 400) (left . 300) (font . "Pragmata Pro-16") )) (select-frame-by-name "remember") (delete-other-windows) (flet ((switch-to-buffer-other-window (buf) (switch-to-buffer buf))) (org-capture nil "t"))) ;; delete the frame in that case (add-hook 'org-capture-after-finalize-hook (lambda () (when (equal (cdr (assoc 'name (frame-parameters (selected-frame)))) "remember") (delete-frame)))) any ideas? thx z On Tue, Jun 9, 2015 at 12:22 PM, Alan Schmitt < alan.schmitt@polytechnique.org> wrote: > Hello Eric, > > On 2015-06-08 17:23, Eric S Fraga writes: > > > as monitors get bigger and bigger, I tend to have lots of (emacs) > > windows in a frame. No matter how many I have, org-capture takes over > > the whole frame which is kind of wasteful. > > How about using several frames? For instance I have the following code > bound globally in my OS: > > #+begin_src sh > /usr/local/bin/emacsclient -n -e '(make-orgcapture-frame)' > #+end_src > > The function is defined as follows (with some supporting code to delete > the frame when I'm done): > > #+begin_src emacs-lisp > (defun make-orgcapture-frame () > "Create a new frame and run org-capture." > (interactive) > (make-frame '((name . "remember") (width . 80) (height . 16) > (top . 400) (left . 300) > (font . > "-*-Consolas-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1") > )) > (select-frame-by-name "remember") > (delete-other-windows) > (flet ((switch-to-buffer-other-window (buf) (switch-to-buffer buf))) > (org-capture nil "t"))) > > ;; delete the frame in that case > (add-hook 'org-capture-after-finalize-hook > (lambda () > (when (equal > (cdr (assoc 'name (frame-parameters (selected-frame)))= ) > "remember") > (delete-frame)))) > #+end_src > > Alan > > -- > OpenPGP Key ID : 040D0A3B4ED2E5C7 > Weekly CO=E2=82=82 average (2015-05-30, Mauna Loa Observatory): 403.41 pp= m > --047d7b2e4fd87046e30518c8f1cb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Alan

your code seems very intersting= and i have been looking for something like this for a while. yet for me it= opens a new frame without org capture. i use linux (arch) and put in the f= ollowing code. please note that when i evaled your code it said:
= `flet' is an obsolete macro (as of 24.3); use either `cl-flet' or `= cl-letf'.
so i changed flet to cl-flet and it still didnt= work :)

here is the code

(defun make-orgcapture-frame ()
=C2=A0 "Create a new f= rame and run org-capture."
=C2=A0 (interactive)
= =C2=A0 (make-frame '((name . "remember") (width . 80) (height= . 16)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (t= op . 400) (left . 300)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (font . "Pragmata Pro-16")
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ))
=C2=A0 (select-frame= -by-name "remember")
=C2=A0 (delete-other-windows)
=C2=A0 (flet ((switch-to-buffer-other-window (buf) (switch-to-buffer = buf)))
=C2=A0 =C2=A0 (org-capture nil "t")))
=
;; delete the frame in that case
(add-hook 'or= g-capture-after-finalize-hook
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = (lambda ()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (equal=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(cdr (assoc 'name (frame-parameters (selected-frame))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"= ;remember")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (delete-frame))))


any ideas?=

thx

z

On Tue, Jun 9, 2015 at 1= 2:22 PM, Alan Schmitt <alan.schmitt@polytechnique.org>= wrote:
Hello Eric,

On 2015-06-08 17:23, Eric S Fraga <= e.fraga@ucl.ac.uk> writes:

> as monitors get bigger and bigger, I tend to have lots of (emacs)
> windows in a frame.=C2=A0 No matter how many I have, org-capture takes= over
> the whole frame which is kind of wasteful.

How about using several frames? For instance I have the following co= de
bound globally in my OS:

#+begin_src sh
/usr/local/bin/emacsclient -n -e '(make-orgcapture-frame)'
#+end_src

The function is defined as follows (with some supporting code to delete
the frame when I'm done):

#+begin_src emacs-lisp
(defun make-orgcapture-frame ()
=C2=A0 "Create a new frame and run org-capture."
=C2=A0 (interactive)
=C2=A0 (make-frame '((name . "remember") (width . 80) (height= . 16)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (top . 400) (left .= 300)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (font . "-*-Co= nsolas-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ))
=C2=A0 (select-frame-by-name "remember")
=C2=A0 (delete-other-windows)
=C2=A0 (flet ((switch-to-buffer-other-window (buf) (switch-to-buffer buf)))=
=C2=A0 =C2=A0 (org-capture nil "t")))

;; delete the frame in that case
(add-hook 'org-capture-after-finalize-hook
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda ()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (equal
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(cdr (= assoc 'name (frame-parameters (selected-frame))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"= remember")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (delete-frame))))
#+end_src

Alan

--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Weekly CO=E2=82=82 average (2015-05-30, Mauna Loa Observatory): 403.41 ppm<= br>

--047d7b2e4fd87046e30518c8f1cb--